Get line of error in Error Handler

I was wondering if there was a way to get the exact line where the error has occurred when using a custom error handler function. Would have made it a lot easier to track the bugs. Currently, I am able to fetch the date, time, form, and user where the error has occurred.

This is my code

def errorhandler(err):
  Notification('We have been notified about the issue and will try to fix it as fast as possible. Meanwhile, you can try refreshing the page to see if the error persists',title='Oops! An unexpected error occured!',style='danger',timeout=15).show()
  try:
    anvil.server.call('errreport',str(err),str(get_open_form()))
  except:
    Notification('Cannot connect to server. Please check your network and try again. If the problem persists, please refresh the page.').show()
set_default_error_handling(errorhandler)

Edit:
I just figured out a workaround to get the line. But is there a better way to do this?

def errorhandler(err):
  L=Label(text=err)
  dom_node=anvil.js.get_dom_node(L)
  err=dom_node.innerText #The Javascript way works but Anvil's text property doesn't
  Notification('We have been notified about the issue and will try to fix it as fast as possible. Meanwhile, you can try refreshing the page to see if the error persists',title='Oops! An unexpected error occured!',style='danger',timeout=15).show()
  try:
    anvil.server.call('errreport',str(err),str(get_open_form()))
  except:
    Notification('Cannot connect to server. Please check your network and try again. If the problem persists, please refresh the page.').show()
set_default_error_handling(errorhandler)