Go to: Synopsis. Notes. Return value. Related. MEL examples.

Synopsis

catchQuiet (expression)

catchQuiet is undoable, NOT queryable, and NOT editable.

catchQuiet will return 1 if the expression in parenthesis produces an error at runtime and 0 otherwise. catchQuiet behaves like catch, except that it supresses warnings and errors.

This expression is designed to allow users to check for runtime failure and recover, if desired. The use of catchQuiet stops a runtime error from being propagated back up through the execution path of the script. Normally, a runtime error results in the termination of the execution of a script or procedure.

Notes

catchQuiet is not a command. It is a keyword in the Mel language. Its usage in Mel scripts looks more like that of procedure calls than of command invocations.

Return value

int0 or 1

Related

catch

MEL examples

  // Set $divisor to 0 just to trigger an exception
  //
  int $divsor = 0;
  int $factor;

  if ( catchQuiet ($factor == 42/$divsor) ) {
      print "Attempt to divide by zero caught\n";
  } else {
      // continue on as usual...
  }

  // This example shows how catchQuiet can be used to handle failure of commands
  // or procedures.  This will catch errors and calls to procedures that do
// not exist. Note, there is no Error: Division by zero in script editor.

  catchQuiet ( `underConstruction` );

  // Without the catchQuiet, if the execution of underConstruction failed at
  // runtime, the whole script containing the call would fail. Using catchQuiet
  // enables this script to continue execution even if something fails.