def http_error(httpexception, errno=None, code=None, error=None, message=None, info=None, details=None):
 errno = (errno or ERRORS.UNDEFINED)
 if isinstance(errno, Enum):
  errno = errno.value
 logger.bind(errno=errno)
 body = {'code': (code or httpexception.code), 'errno': errno, 'error': (error or httpexception.title)}
 if (message is not None):
  body['message'] = message
 if (info is not None):
  body['info'] = info
 if (details is not None):
  body['details'] = details
 response = httpexception
 response.body = json.dumps(body).encode('utf-8')
 response.content_type = 'application/json'
 return response

def http_error ( httpexception , errno = None , code = None , error = None , message = None , info = None , details = None ) : errno = ( errno or ERRORS . UNDEFINED ) if isinstance ( errno , Enum ) : errno = errno . value logger . bind ( errno = errno ) body = { 'code' : ( code or httpexception . code ) , 'errno' : errno , 'error' : ( error or httpexception . title ) } if ( message is not None ) : body [ 'message' ] = message if ( info is not None ) : body [ 'info' ] = info if ( details is not None ) : body [ 'details' ] = details response = httpexception response . body = json . dumps ( body ) . encode ( 'utf-8' ) response . content_type = 'application/json' return response
return a json formated response matching the error http api .