Skip to content

on_error

jeremywinters edited this page May 18, 2017 · 5 revisions

Command: ON_ERROR

description:

error handling. if the previously executing tag raises an error, the action specified by this tag will be taken. if the previous command does not raise an error, the on_error command will be ignored, and the transform will exit.

parameters:

  • action - continue, exit_step, execute

behavior:

if an error is raised by the previous command tag, the action parameter will specify how to handle the error:

  • continue - error will be ignored and SneaQL will continue to run.
  • exit_step - the current step will be exited (much like the exit_step_if command tag).
  • execute - the SQL statement following the tag will be executed. note that this will only happen in the event of an error.

examples:

/*-execute-*/
--raises an error because string is not a SQL data type
create table sneaql(a string);

/*-on_error continue-*/ -- error will be ignored
--or
/*-on_error exit_step-*/ step will be exited, next step will execute
--or
/*-on_error execute-*/
create table if not exists sneaql(a varchar(100));

/*-execute-*/
--moving forward amicably
update aviary set bird='turkey';