EasyManua.ls Logo

Oracle ZFS Storage Appliance

Oracle ZFS Storage Appliance
650 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Using the Choices Function
Understanding CLI Scripting Errors
When an error is generated, an exception is thrown. The exception is generally an object that
contains the following members:
code - a numeric code associated with the error
message - a human-readable message associated with the error
Exceptions can be caught and handled, or they may be thrown out of the script environment. If
a script environment has an uncaught exception, the CLI will display the details. For example:
dory:> script run('not a cmd')
error: uncaught error exception (code EAKSH_BADCMD) in script: invalid command
"not a cmd" (encountered while attempting to run command "not a cmd")
You could see more details about the exception by catching it and dumping it out:
dory:> script try { run('not a cmd') } catch (err) { dump(err); }
{
toString: <function>,
code: 10004,
message: 'invalid command "not a cmd" (encountered while attempting to
run command "not a cmd")'
}
This also allows you to have rich error handling, for example:
#!/usr/bin/ksh -p
ssh -T root@dory <<EOF
script
try {
run('shares select default select $1');
} catch (err) {
if (err.code == EAKSH_ENTITY_BADSELECT) {
printf('error: "$1" is not a share in the ' +
'default project\n');
exit(1);
}
throw (err);
}
printf('"default/$1": compression is %s\n', get('compression'));
exit(0);
EOF
About the Oracle ZFS Storage Appliance 53

Table of Contents

Other manuals for Oracle ZFS Storage Appliance

Related product manuals