How to access traceback when using set_default_error_handling

Hi guys,

Is it possible to access the full traceback when using set_default_error_handling?

Based on this discussion from 2019, it doesn’t seem possible: set_default_error_handling

My current code looks like this:

def error_handler(err):
  """Opens up Error Form and sends error message to developers"""
  print("-"*10)
  print(err)
  print("-"*10)
  routing.load_error_form()
  routing.clear_cache()
  Notification("An unexpected error has occured. \n Please refresh page!",
                   style="danger", timeout=0, title='Refresh Page!').show()
  anvil.server.call_s('send_error_to_developers', str(err))

set_default_error_handling(error_handler)

I would like to send err to the server to include the full traceback in an email to the developers of the application. Any suggestions how this can be accomplished? I know the full traceback is printed in the logs, however, if my app is logging many things, I might exceed the log limit of 96 lines (or whatever it may be) and therefore miss a crucial piece of debugging info. That’s why I want to be able to send the traceback directly to the developers via email.

Any other workarounds perhaps?

3 Likes