[Debug] add $replace arg to ErrorHandler::register()