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:
- TypeScript
- JavaScript
- Python
import { Action } from "@interval/sdk";
export default new Action(async () => {
throw new Error("Something went wrong!");
});
const { Action } = require("@interval/sdk");
export default new Action(async () => {
throw new Error("Something went wrong!");
});
import os
from interval_sdk import Interval, IO
interval = Interval(
os.environ["INTERVAL_API_KEY"],
)
@interval.action
async def error_example(io: IO):
raise Exception("Something went wrong!")
interval.listen()
Would cause this message to be displayed to the person running your action:

Errors in pages
Interval will also catch and display any error within a page handler
function.
Errors thrown in a function passed to populate the title
or description
of a page's Layout
will also be caught and displayed, but the rest of the page will display as usual.
Did this section clearly explain what you wanted to learn?