Try Catch Suggestion

Hi, this is more a suggestion than a problem. Also, as you read this bear in mind that I am still using ver 3.9.7 and am 5 versions of wappler behind, so if this is already done in later versions, good. Also, maybe I am being a bit clumsy in my constructs so suggestions in my technique are welcome.

The suggestion is to make the code a lot easier in the server side action steps. Here is an example of what I am doing, which is to put a Try/Catch around every step that executes something external to wappler, in this case, a FileUpload and a Database Insert. I find that if I do not do this and there is an error then the Step just stops with no error message.

image

Its always the same with the Error being a response of $_Error (for me anyway).
I was just wondering if the $_Error could be automatically generated in such steps, without the need for a try catch. And I do realise that means that a customization of the error message from just being $_Error would be foregone but that can be done in the onError in the App anyway.
If this was adopted then my code would look like …
image
How simple is that! And much more maintainable.

Community Page
Last updated: