Help

Re: Automated Script Error Reporting / Alerting

Solved
Jump to Solution
4465 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Gather
5 - Automation Enthusiast
5 - Automation Enthusiast

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?

1 Solution

Accepted Solutions
Alyssa_Buchthal
8 - Airtable Astronomer
8 - Airtable Astronomer

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.

See Solution in Thread

8 Replies 8
Alyssa_Buchthal
8 - Airtable Astronomer
8 - Airtable Astronomer

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.

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!

Alyssa_Buchthal
8 - Airtable Astronomer
8 - Airtable Astronomer
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.

Alyssa_Buchthal
8 - Airtable Astronomer
8 - Airtable Astronomer

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

Kevin_Hylant
4 - Data Explorer
4 - Data Explorer

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

I was looking for a way to prevent the default errors from constantly sending me errors. This is due to some automations overlapping my cleanup tasks and sometimes trying to delete the same record twice. The other option was to trigger the cleanup at a particular time and every 15 minutes is too long (why don't they allow every minute like a cron job?) Anyways, using your code above without the 'throw new error` works great!