1 #!/usr/bin/env python 2 3 """ 4 Errors for DOM Level 3. 5 See: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ERROR-Interfaces-DOMError 6 7 Copyright (C) 2008 Paul Boddie <paul@boddie.org.uk> 8 9 This program is free software; you can redistribute it and/or modify it under 10 the terms of the GNU Lesser General Public License as published by the Free 11 Software Foundation; either version 3 of the License, or (at your option) any 12 later version. 13 14 This program is distributed in the hope that it will be useful, but WITHOUT 15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 17 details. 18 19 You should have received a copy of the GNU Lesser General Public License along 20 with this program. If not, see <http://www.gnu.org/licenses/>. 21 """ 22 23 class DOMError: 24 25 "DOM Level 3 Core exception." 26 27 SEVERITY_WARNING = 1 28 SEVERITY_ERROR = 2 29 SEVERITY_FATAL_ERROR = 3 30 31 def __init__(self, severity=None, message=None, type=None, relatedException=None, relatedData=None, location=None): 32 self.severity = severity 33 self.message = message 34 self.type = type 35 self.relatedException = relatedException 36 self.relatedData = relatedData 37 self.location = location 38 39 def __repr__(self): 40 return "DOMError(%d, %r, %r)" % (self.severity, self.message, self.type) 41 42 def __str__(self): 43 return "DOMError: %s" % self.message 44 45 # vim: tabstop=4 expandtab shiftwidth=4