Stripe.js & General Error Handling 101

Hello everyone,

I recently just wrapped up a session with CoBubble (highly recommend btw if you have any roadblocks) that covered error handling, and I thought I would share what I learned in the session.

Stripe.js Error Handling

If you’ve worked with Stripe in your application, you know by now that you need to securely create a token to be able to submit the user’s payment information to Stripe. In my case, I would create a card token, and then run a workflow whenever a card token has been successfully created. The part I couldn’t figure out is how to handle the case where something went wrong with the payment.

To handle this, you need to create a separate workflow for when “a Stripetoken could not be created”. In this workflow, I would then “Show message in <your_alert>” (an action), which had “This Stripetoken’s error message”. Easy as that!

General Page Error Handling

This is referring to all of the errors that you can find under Settings >> Languages >> Application Texts & Messages. By default, Bubble shows a browser-specific popup with the error code, the message, and possibly some JSON - all of which you probably don’t want your users seeing. These error popups will also appear if something happens with one of your third-party API’s.

For Bubble-specific errors, they will have an error code. To handle these, create a workflow that runs when General >> an unhandled error occurs. From there, “Show message in <your_alert>” >> “Current workflow error’s message” >> “Only when workflow error’s code is not empty”.

Since there is a wide range of what could go wrong in an API error, this messaging needs to be more generalized. API errors also don’t have an error code. You’ll want to set it up as (in the same workflow) “Show message in <your_alert>” >> “An error has occurred” >> “Only when workflow error’s code is empty”.


It was also mentioned that I should save a new log whenever an error occurs, that way we can get some insight into what happened (bonus tip: bundle with the Browser Plugin to get information documented about the user).

Special thanks to CoBubble for the help, and hopefully others will find this information useful!

4 Likes

Perfect post and definitely needed! Thanks!

1 Like

Is there a way to apply theses error handling workflows to every page with a single workflow? Or do you have to repeat the workflow on every page that uses the functionality or various plugins?