1
# Copyright (C) 2004,2005 PreludeIDS Technologies. All Rights Reserved.
2
# Author: Nicolas Delon <nicolas.delon@prelude-ids.com>
4
# This file is part of the Prewikka program.
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2, or (at your option)
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; see the file COPYING. If not, write to
18
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24
from prewikka import DataSet
25
from prewikka.templates import ErrorTemplate
29
class PrewikkaError(Exception):
32
class PrewikkaUserError(PrewikkaError):
33
def __init__(self, name, message, display_traceback=False, log=None, log_user=None):
34
self.dataset = DataSet.DataSet()
35
self.template = "ErrorTemplate"
36
self.dataset["message"] = message
37
self.dataset["name"] = name
38
self._log_priority = log
39
self._log_user = log_user
42
output = StringIO.StringIO()
43
traceback.print_exc(file=output)
46
self.dataset["traceback"] = tmp
48
self.dataset["traceback"] = None
51
return self.dataset["message"]