Output from queries with errors

[CR #342782] A query that results in an error does not return an output, even if a result exists for the query.