'Verify that the error handler works as expected, in other words, do NOT
crash on response codes not in range 200-300.'

@attr('moth')
def test_error_handler_id(self):

    fail_url = URL(get_moth_http('/abc/def/do-not-exist.foo'))
    settings = opener_settings.OpenerSettings()
    settings.build_openers()
    opener = settings.get_custom_opener()
    request = HTTPRequest(fail_url)
    try:
        opener.open(request)
    except urllib2.HTTPError as response:
        self.assertEqual(response.code, NOT_FOUND)
        self.assertEqual(response.id, 1)
