Errors
Produce human-friendly errors from your tasks
When a task fails, surfacing an error message to the user who ran your task can help them debug what
went wrong without spelunking through logs or pinging the engineering team. Airplane supports a
convention for producing errors from tasks that integrates with the rest of Airplane.
Data model
Errors are returned from tasks through Output via the following convention:
jsonCopied1{2"error": "Your error message here..."3}
Rendering
If a task produced an error, the output UI will render the error's message:

Producing errors
Errors can be produced by throwing an error and letting it bubble up beyond your task's main
method. All uncaught errors will be automatically converted into error output and a stack trace
will be printed in the run logs.
typescriptCopied1export default async function (params) {2if (!isValidEmail(params.email)) {3// Errors like this will be converted to error output automatically:4throw new Error(`Expected a valid email address: got ${params.email}`);5}67try {8const run = await airplane.sql.query(/** ... */);9// ...10} catch (err) {11// You can catch errors to handle or ignore them.12// ...13}14}
Errors can be produced by throwing an error and letting it bubble up beyond your task's main
method. All uncaught errors will be automatically converted into error output and a stack trace
will be printed in the run logs.
javascriptCopied1export default async function (params) {2if (!isValidEmail(params.email)) {3// Errors like this will be converted to error output automatically:4throw new Error(`Expected a valid email address: got ${params.email}`);5}67try {8const run = await airplane.sql.query(/** ... */);9// ...10} catch (err) {11// You can catch errors to handle or ignore them.12// ...13}14}
Errors can be produced by throwing an error and letting it bubble up beyond your task's main
method. All uncaught errors will be automatically converted into error output and a stack trace
will be printed in the run logs.
pythonCopied1import airplane23@airplane.task()4def my_task(email: str):5if not is_valid_email(email):6# Errors like this will be converted to error output automatically:7raise Exception(f"Expected a valid email address: got {email}")89try:10run = airplane.sql.query("...")11except Exception:12# You can catch exceptions to handle or ignore them.13# ...
Errors can be produced by logging Output. Make sure you wrap
your error message in double quotes so that it is a valid JSON string.
bashCopied1echo "airplane_output_set:error" '"Your error message here..."'2# airplane_output_set:error sets the `error` key on the output3# Equivalent output: {"error": "Your error message here..."}