Catch, Server Connect?

Lets assume I have been buffering for a few years…

I’ve been using DMX extensions for some years now, and have adopted Wappler as my replacement for both DW and my DMX Subscription, but I still do not quite know what Catch is used for in Server Connect?

Please can one of the fine members of this community, or the outstanding team at Wappler, explain this to me?

:smiley:

Much appreciated!

1 Like

Hey Dave,

Normally, if you have not defined any steps under catch and some of the steps in your server action results in an error - then the server action just ends, and an error message is generated.

If you want to create your own error handler, like for example - sending an email, when there was an error during executing the server action, you place the send mail step under catch.

Another example - you insert some data into the db and then upload an image related with this record, but the upload returns an error … you can remove the last inserted record in the catch steps.

5 Likes

Thanks Teodor that all seems extremely useful and not so well documented. I think I’m going to start implementing some of this functionality in to my Actions in the future. Thanks for explaining.

:slight_smile:

2 Likes

Hi Dave,

In case it helps, here’s an example.

I created an action to create database records for contents of an image folder. The process appeared to work fine but in fact stopped before all the records were created. It turned out one of the files had a size of zero bytes which stopped any more processing. This was an unexpected and rather unlikely problem, probably caused by an FTP error (the files mighit be uploaded via a browser or FTP).

I added a response step like this:

In App Connect, I added a dynamic event to the server action - using the ‘Invalid’ option. You can then include these bindings in a notification for example:

image

… which, in this case, will return:
400
Bad Request
imagename.jpg

I’m sure there’s a lot more potential with this feature than I’ve used or discovered so far. Eg I would be interested in knowing more about specifying the status in server connect and the triggering of dynamic events in app connect.

9 Likes

Thanks for the example Tom that is very appreciated. I can already envisage many scenarios where the Catch ability could really help with not only diagnosing issues but also throwing a response to the User and Administration team.

3 Likes

Thanks, I’ve wondered about this as well.

Yes, glad someone asked the question :slight_smile: