summaryrefslogtreecommitdiffstats
path: root/cobbler/cobbler_exception.py
blob: c6abfce0ef8b4a51ca1d9df57a70bbbe67cf5662 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""
Custom error for fatal cobbler exceptions that come with human readable error messages.
These can be caught and printed without stack traces.

Michael DeHaan <mdehaan@redhat.com>
"""

import exceptions
import cobbler_msg

class CobblerException(exceptions.Exception):

   def __init__(self, value, args=[]):
       if type(args) == str or type(args) == int:
           args = (args)
       self.value = cobbler_msg.lookup(value) % args

   def __str__(self):
       return repr(self.value)