- Improve exception handling and error displaying in the ogc server.
This commit is contained in:
parent
6ed05bcf42
commit
2bc9ef83cc
1 changed files with 6 additions and 9 deletions
|
@ -25,7 +25,7 @@ from PIL.Image import fromstring, new
|
||||||
from PIL.ImageDraw import Draw
|
from PIL.ImageDraw import Draw
|
||||||
from StringIO import StringIO
|
from StringIO import StringIO
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from traceback import print_tb
|
from traceback import format_exception, format_exception_only
|
||||||
from sys import exc_info
|
from sys import exc_info
|
||||||
from lxml import etree as ElementTree
|
from lxml import etree as ElementTree
|
||||||
import re
|
import re
|
||||||
|
@ -359,16 +359,13 @@ class BaseExceptionHandler:
|
||||||
|
|
||||||
def getresponse(self, params):
|
def getresponse(self, params):
|
||||||
code = ''
|
code = ''
|
||||||
message = ''
|
message = '\n'
|
||||||
excinfo = exc_info()
|
excinfo = exc_info()
|
||||||
if self.debug:
|
if self.debug:
|
||||||
fh = StringIO()
|
messagelist = format_exception(excinfo[0], excinfo[1], excinfo[2])
|
||||||
print_tb(excinfo[2], None, fh)
|
else:
|
||||||
fh.seek(0)
|
messagelist = format_exception_only(excinfo[0], excinfo[1])
|
||||||
message = '\n' + fh.read() + '\n' + str(excinfo[0]) + ': ' + ', '.join(str(excinfo[1].args)) + '\n'
|
message += ''.join(messagelist)
|
||||||
fh.close()
|
|
||||||
elif len(excinfo[1].args) > 0:
|
|
||||||
message = excinfo[1].args[0]
|
|
||||||
if isinstance(excinfo[1], OGCException) and len(excinfo[1].args) > 1:
|
if isinstance(excinfo[1], OGCException) and len(excinfo[1].args) > 1:
|
||||||
code = excinfo[1].args[1]
|
code = excinfo[1].args[1]
|
||||||
exceptions = params.get('exceptions', None)
|
exceptions = params.get('exceptions', None)
|
||||||
|
|
Loading…
Reference in a new issue