1 ##############################################################################
2 # Copyright (c) 2017 ZTE Corp
3 # feng.xiaowei@zte.com.cn
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
11 from tornado import web
17 def __init__(self, reason):
18 raise web.HTTPError(self.code, reason)
21 class BadRequest(Raiser):
22 code = httplib.BAD_REQUEST
25 class Forbidden(Raiser):
26 code = httplib.FORBIDDEN
29 class NotFound(Raiser):
30 code = httplib.NOT_FOUND
33 class Unauthorized(Raiser):
34 code = httplib.UNAUTHORIZED
37 class CodeTBD(object):
38 def __init__(self, code, reason):
39 raise web.HTTPError(code, reason)