# Path: nolang/builtins/spec.py
# def unwrap_spec(**spec):
#     def wrapper(func):
#         func.unwrap_spec = spec
#         return func
#     return wrapper
# 
# class TypeSpec(object):
#     def __init__(self, name, constructor, methods=None, properties=None,
#                  parent_name=None, is_subclassable=False):
#         self.constructor = constructor
#         self.name = name
#         if methods is None:
#             methods = {}
#         self.methods = methods
#         if properties is None:
#             properties = {}
#         self.properties = properties
#         self.parent_name = parent_name
#         self.is_subclassable = is_subclassable
# 
# Path: nolang/objects/userobject.py
# class W_UserObject(W_Root):
#     def __init__(self, w_type):
#         self.w_type = w_type
#         self._dict_w = {}
# 
#     def gettype(self, space):
#         return self.w_type
# 
#     def setattr(self, space, attrname, w_val):
#         if self.w_type.force_names is not None:
#             if attrname not in self.w_type.force_names:
#                 msg = '%s is not an allowed attribute of object of class %s' % (
#                     attrname, self.w_type.name)
#                 raise space.apperr(space.w_attrerror, msg)
#         self._dict_w[attrname] = w_val
# 
#     def getattr(self, space, attrname):
#         try:
#             return self._dict_w[attrname]
#         except KeyError:
#             return space.w_NotImplemented


from nolang.builtins.spec import unwrap_spec, TypeSpec
from nolang.objects.userobject import W_UserObject


class W_Exception(W_UserObject):
    def __init__(self, w_tp, message):
        W_UserObject.__init__(self, w_tp)
        self.message = message

    def get_message(self, space):
        return space.newtext(self.message)

    def __repr__(self):
        return '<%s %s>' % (self.w_type.name, self.message)



# Path: nolang/builtins/spec.py
# def unwrap_spec(**spec):
#     def wrapper(func):
#         func.unwrap_spec = spec
#         return func
#     return wrapper
# 
# class TypeSpec(object):
#     def __init__(self, name, constructor, methods=None, properties=None,
#                  parent_name=None, is_subclassable=False):
#         self.constructor = constructor
#         self.name = name
#         if methods is None:
#             methods = {}
#         self.methods = methods
#         if properties is None:
#             properties = {}
#         self.properties = properties
#         self.parent_name = parent_name
#         self.is_subclassable = is_subclassable
# 
# Path: nolang/objects/userobject.py
# class W_UserObject(W_Root):
#     def __init__(self, w_type):
#         self.w_type = w_type
#         self._dict_w = {}
# 
#     def gettype(self, space):
#         return self.w_type
# 
#     def setattr(self, space, attrname, w_val):
#         if self.w_type.force_names is not None:
#             if attrname not in self.w_type.force_names:
#                 msg = '%s is not an allowed attribute of object of class %s' % (
#                     attrname, self.w_type.name)
#                 raise space.apperr(space.w_attrerror, msg)
#         self._dict_w[attrname] = w_val
# 
#     def getattr(self, space, attrname):
#         try:
#             return self._dict_w[attrname]
#         except KeyError:
#             return space.w_NotImplemented


# Path: nolang/builtins/exception.py
from nolang.builtins.spec import unwrap_spec, TypeSpec
from nolang.objects.userobject import W_UserObject



class W_Exception(W_UserObject):
    def __init__(self, w_tp, message):
        W_UserObject.__init__(self, w_tp)
        self.message = message

    def get_message(self, space):
        return space.newtext(self.message)

    def __repr__(self):
        return '<%s %s>' % (self.w_type.name, self.message)



@unwrap_spec(msg='utf8')