Added error_code in error_handler methods