I already know that I can use the Screen.ErrorOccurred block in order to prevent an Error 1101 message (Unable to get a response with the specified URL) from being displayed.
This is working so far, but when there happens to be an error inside the Screen.ErrorOccurred block, the original message including the full URL shows up nevertheless! This will be an app security issue if the URL is containing secret credentials.
I created the following example:
When I do a Web.Get call and an error occurs, my user-defined message is displayed. But if I intentionally provoke an error within the Screen.ErrorOccurred block, the full URL and therefore my secret credentials are displayed to the user.
My question is: How can I 100% protect the full URL from being displayed? You know, I can’t rule out with certainty that there might occur an unforeseen error within my own error handling procedures.
ErrorOccurredError.aia (2.1 KB)
Here are the blocks of my example. An unforeseen error happened inside Screen.ErrorOccurred:
you might want to do some tests... for example set your device into flight mode to test your app...
also what kind of unforseen error in the ErrorOccurred event should occur, if you only display your error message?
I created this simplified example just to explain the problem. In my real app, error handling is more complex than a simple error message. Usually it works fine, but in rare cases the original 1101 error message shows up, which I first couldn’t explain. Now that I found out that it must be because of an (currently unidentified) error within my Screen.ErrorOccurred code, I wanted to know if there’s a way to address the underlying problem, which would also be a benefit for other users. Would it be possible to change the behavior of the Screen.ErrorOccurred block, so that error messages won’t show up in case of a bug within the error handling?
If dispatchEvent returned false, then no user-supplied error handler was run. If in addition, the screen initializer was run, then we assume that the user did not provide an error handler. In this case, we run a default error handler, namely, showing a notification to the end user of the app. The app writer can override this by providing an error handler.
In other words, the EventDispatcher tries to run a user-supplied error handler (= my Screen.ErrorOccurred block). If it returns false, it is assumed that there is no error handler at all and a notifier alert message is displayed. Unfortunately, this is also the case if I do provide an error handler which doesn't finish its execution because of a user-supplied bug.
Would it be possible to distinguish between those two cases?
there is no error handler at all
there was an error within the handler during the handling of the event
what exactly prevents you from testing your app, especially that error case before releasing it into production?
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.
To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.