Disable Red Error Window

Issue:
I’m not fully understanding the custom error handling documentation. Where do I define the function and call it? Is it in the server module and I need to add the decorator to call it?

Really what I’m trying to do is disable the red error popup. This is my first app and wrote a bunch of custom alerts not knowing about the read alert popup. So now I trigger both my alert and the built-in alert. So I just want to get rid of the built-in alert.

Attempt:
I wanted to establish the custom error function then just use pass. But I can’t get the function to work at all including the example code. I’ve tried putting the code in the server module and design code but it’s just not working for me. I know I must be missing something. I just can’t nail down what it is.

As I understand it, you would put both the handler function and the call to set_default_error_handling at the global level (not inside a class or function), in your app’s Main Form (or Main Module, if that’s what you’re using).

That’s where I have mine.

2 Likes

Can you tell me more clearly. I also want to do a similar thing.

Basically I have no problem with ‘This App has experienced a problem’

However, I want to disable the more information button.

I hope this is clearer.

  1. See the example code at Anvil Docs | Error Reporting.
  2. Copy those three lines of code to the bottom of your Startup Form’s Python code. Or, if you have a Startup Module (instead of a Startup Form), copy them to the bottom of the Startup Module’s Python code.

You can change the name error_handler (in both places where it appears).

You can change what the error_handler function does, as you see fit.

1 Like

Yeah that cleared it.
Thanks

I will now add a button to my alert which will set the text as the message I want to display and the tag as the actual error. That way I can get all details about the errors and users won’t know about my embarrising mistakes :sweat_smile:

1 Like

Yes, this did clear it up! I was putting the code in various parts of the form class. As soon as I put it outside of it at the bottom as you suggested it worked like a charm. Thank you!