Skip to main content

Error handling

When an error is thrown during the execution of an action, Interval will catch it and display an "error" completion state to the person running your action.

In practice, this means you can safely throw errors inside your action code without writing additional try/catch blocks.

By example, the following code:

import Interval from "@interval/sdk";

new Interval({
apiKey: "<YOUR API KEY>", // get an API key at https://interval.com/dashboard/develop/keys
actions: {
error_example: async () => {
throw new Error("Something went wrong!");
},
},
}).listen();

Would cause this message to be displayed to the person running your action:

Did this section clearly explain what you wanted to learn?