kopia lustrzana https://github.com/micropython/micropython-lib
traceback: Add basic versions of format_exc() and format_exception().
rodzic
d040285fbd
commit
151c671243
|
@ -6,6 +6,9 @@ def format_tb(tb, limit):
|
||||||
def format_exception_only(type, value):
|
def format_exception_only(type, value):
|
||||||
return [repr(value) + "\n"]
|
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):
|
def print_exception(t, e, tb, limit=None, file=None, chain=True):
|
||||||
if file is None:
|
if file is None:
|
||||||
file = sys.stdout
|
file = sys.stdout
|
||||||
|
@ -13,3 +16,6 @@ def print_exception(t, e, tb, limit=None, file=None, chain=True):
|
||||||
|
|
||||||
def print_exc(limit=None, file=None, chain=True):
|
def print_exc(limit=None, file=None, chain=True):
|
||||||
print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain)
|
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))
|
||||||
|
|
Ładowanie…
Reference in New Issue