Pass query to the error_message method if exists