Workflow Error Handling - Oracle ZFS Storage Appliance Administration Manual

Hide thumbs Also See for ZFS Storage Appliance:
Table of Contents

Advertisement

Workflow Error Handling

Optional Member
If a parameter is optional and is unset, its member in the parameters object passed to the
execute function will be set to undefined.
Workflow Error Handling
If, in the course of executing a workflow, an error is encountered, an exception will be thrown.
If the exception is not caught by the workflow itself (or if the workflow throws an exception
that is not otherwise caught), the workflow will fail, and the information regarding the
exception will be displayed to the user. To properly handle errors, exceptions should be caught
and processed. For example, in the previous example, an attempt to create a share in a non-
existent project results in an uncaught exception.
EXAMPLE 22
This example could be modified to catch the offending error, and create the project in the case
that it doesn't exist:
var workflow = {
name: 'Create share',
description: 'Creates a new share in a business unit',
parameters: {
name: {
label: 'Name of new share',
type: 'String'
},
unit: {
label: 'Business unit',
type: 'ChooseOne',
options: [ 'development', 'finance', 'qa', 'sales' ],
optionlabels: [ 'Development', 'Finance',
}
},
execute: function (params) {
try {
run('shares select ' + params.unit);
} catch (err) {
if (err.code != EAKSH_ENTITY_BADSELECT)
throw (err);
592
Oracle ZFS Storage Appliance Administration Guide, Release OS8.6.x • September 2016
Workflow Error Handling
'Quality Assurance', 'Sales/Administrative' ],
Type
Description
executed without a value being
specified for the parameter.

Advertisement

Table of Contents
loading

Table of Contents