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