HH-39242 add tests and fix ErrorHandler