Surprisingly, this doesn't come as a standard function in the Exception class.
1.
import
traceback
2.
try
:
3.
raise
Exception(
"print exception!"
)
4.
except
:
5.
print
traceback.format_exc()
Short and simple, so good!
Mainly notes to future-Twig (and for anyone else who may find them useful)
If you've found one or more of my blog posts helpful, why not say thanks by buying me a coffee or beer?
Surprisingly, this doesn't come as a standard function in the Exception class.
1.
import
traceback
2.
try
:
3.
raise
Exception(
"print exception!"
)
4.
except
:
5.
print
traceback.format_exc()
Short and simple, so good!