Fixed order of error exception arguments, and optionality of error handler arguments.
Merge pull request #3802 from ezzatron/error-exception-arguments

Fixed 2 bugs in the error handler implementation