question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Sentry not logging chain exception `raise Exception() from e`

See original GitHub issue

Sentry not logging chain exception raise Exception() from e

for example

class FooFail(Exception):
	pass

try:
	1/0
except Exception as e:
	raise FooFail('a foo exception.') from e

Since e contain the information use to identify cause of root exception. It is very important to see chain exception detail. The missing of detail in Sentry issue panel.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
untitakercommented, Jan 13, 2021

If you see a plaintext traceback you will have a bad time for a lot of reasons:

  1. those events do not group well into issues as we don’t have semantic knowledge of the stacktrace (it’s just a string to the server)
  2. apparently, and this is new to me, chained exceptions can also go missing

Usually this is caused by code that stringifies the exception using the traceback module and then logs it. You can find out which logger that is using the logger event tag.

1reaction
untitakercommented, Jan 13, 2021

Both exceptions should show on the details page.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sentry not showing exception in web UI with logger.exception()
The sentry UI only shows the logged message and no stack trace. With regards to Sentry best practices (in python as well):. Do...
Read more >
Usage for Logging | Sentry Documentation
Usage. Sentry's SDK hooks into your runtime environment and automatically reports errors, uncaught exceptions, and unhandled rejections as well as other types ...
Read more >
Handling exceptions in Python like a pro | Hacker News
Exception chaining (`raise from`) was new to me but after reading the docs it seems to be the default behavior in except/finally blocks,...
Read more >
Distributed Logging in Federated Applications, with Sentry
When it comes to distributed applications, Javascript logging gets tricky. ... throw new Error(`Remote ${remote} is not avaliable on window.
Read more >
Exception Interface - Sentry Developer Documentation
try: raise Exception except Exception as e: raise ValueError from e ... any exception mechanism attribute, even if the SDK cannot determine the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found