Automated Script Error Reporting / Alerting

Hey y’all,

Starting to dip my toes into Airtable Automations which are pretty neat, but worried about long term maintainability if I am to lean on them more heavily.

Do you all know of any ways to report errors within Airtable itself? Or is it better to wrap all scripts in a try catch & report to an external error service like Sentry?

Airtable sends an email whenever an automation hits an error and records all the details of a failed run in the run history. You also have the option if you use a scripting step to set custom error codes for your own personal reference in those failure notifications. It’s not the most robust system, but if you have documentation around your automations then it isn’t too difficult to debug when you do encounter issues.

1 Like

Thank you @Alyssa_Buchthal - I actually saw that this morning in a failed Automation run, it wasn’t immediately obvious to see the run history or failed runs until I received that failure notification - which was super helpful & basically answered all of my questions/problems.

What do you mean by setting custom error codes? Do you mean that in the output.set() you could set a property or is there a built-in utility?

No need to set as output, when you use basic try catch, if it catches an error, the email from AT that usually gets sent on automations encountering an error will report to you what your code was for your own reference. They’re pretty nifty like that.

Just trying to make sure I understand fully.

If I wrap my script in a try, catch, and in the catch block I throw a custom error, Airtable will report that custom error for reference?

e.g.

try {
  await doApiRequest()
} catch (err) {
  console.error(err);
  throw new Error('My custom error');
}

Sorry for the perhaps dumb question - a basic code block would be very helpful.

THANK YOU!

function iseven(num) {
    if ((num % 2) == 0) {
        return TRUE;
    } else {
        return FALSE;
    }
}
try {
    iseven("Words");
} catch(e) {
    console.error(e);
    throw new Error("My custom error");
}

Here’s an example. I checked my email and while I had another automation like this which definitely emailed me when my custom error was thrown, it doesn’t seem to be doing that anymore. Unsure why, but here’s the execution log from a failed run:
image

So you can see it is failing and recording my custom error code as intended.

I should have had faith! Email dropped a tad late:
image

Thank you! This is INCREDIBLY helpful and good to see the real world example of it at work. :slight_smile:

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.