Improve error handling for simulator:

Error status code is set to INVALID_REQUEST when it is not already set.