add ErrorHandlerFunc and tests
fix typo