#!/usr/bin/env python

import cherrypy
from cherrypy import HTTPError

class DmHttpError(HTTPError):
    def __init__ (self, httpCode, httpError, dmEx):
        HTTPError.__init__(self, httpCode, httpError)
        self.dmException = dmEx

    def set_response(self):
        HTTPError.set_response(self)
        cherrypy.response.headers['Dm-Status-Code'] = self.dmException.getErrorCode()
        cherrypy.response.headers['Dm-Status-Message'] = self.dmException.getErrorMessage()
        cherrypy.response.headers['Dm-Exception-Type'] = self.dmException.getExceptionType()