added custom error handler

`$errorNumber` -> `$code`