language/core: add EncodedException

This commit is contained in:
Sebastien Bourdeauducq 2014-09-21 23:17:46 +08:00
parent 426d6dd979
commit 320d3c36ed
1 changed files with 17 additions and 0 deletions

View File

@ -329,3 +329,20 @@ def syscall(*args):
""" """
return _syscall_manager.do(*args) return _syscall_manager.do(*args)
_encoded_exceptions = dict()
def EncodedException(eid):
"""Represents exceptions on the core device, which are identified
by a single number.
"""
try:
return _encoded_exceptions[eid]
except KeyError:
class EncodedException(Exception):
def __init__(self):
Exception.__init__(self, eid)
_encoded_exceptions[eid] = EncodedException
return EncodedException