forked from micropython/micropython-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtraceback.py
More file actions
27 lines (15 loc) · 677 Bytes
/
Copy pathtraceback.py
File metadata and controls
27 lines (15 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import sys
def format_tb(tb, limit):
return ["traceback.format_tb() not implemented\n"]
def format_exception_only(type, value):
return [repr(value) + "\n"]
def format_exception(etype, value, tb, limit=None, chain=True):
return format_exception_only(etype, value)
def print_exception(t, e, tb, limit=None, file=None, chain=True):
if file is None:
file = sys.stdout
sys.print_exception(e, file)
def print_exc(limit=None, file=None, chain=True):
print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain)
def format_exc(limit=None, chain=True):
return "".join(format_exception(*sys.exc_info(), limit=limit, chain=chain))