Previous: , Up: getopts   [Index]


16.5 Exceptions and condition objects

When getopts detects an error in the input command line arguments, it raises a continuable exception; returning from the exception is possible and makes getopts go on parsing with the next argument. It is not always advisable to continue parsing after an error has been signaled.

The raised exception values are compound condition of the types described below.

Base condition object

Condition Type: &getopts

Base type for all the condition objects thrown by getopts; it is derived from &error. It has no fields.

Function: make-getopts-condition
Function: getopts-condition? obj

Constructor and predicate for the &getopts condition object.

Option data object

Condition Type: &option

Data condition type used to hold records of type command-line-option describing an option involved in an error; it is derived from &condition.

Function: make-option-condition option-record
Function: option-condition? obj

Constructor and predicate for the &option condition object.

Function: condition-option option-condition

Accessor for the option field of a &option condition object.

Argument data object

Condition Type: &argument

Data condition type used to hold Scheme strings representing command line arguments involved in an error; it is derived from &condition.

Function: make-argument-condition argument-string
Function: argument-condition? obj

Constructor and predicate for the &argument condition object.

Function: condition-argument argument-condition

Accessor for the argument field of a &argument condition object.

Option selector data object

Condition Type: &brief/long

Data condition type used to hold Scheme strings or characters representing option selectors involved in an error; it is derived from &condition.

Function: make-brief/long-condition brief/long-string
Function: brief/long-condition? obj

Constructor and predicate for the &brief/long condition object.

Function: condition-brief/long brief/long-condition

Accessor for the field of a &brief/long condition object.

Unknown option error

Condition Type: &unknown-option

Condition type used to signal an “unknown option” error; it is derived from &getopts. It has no fields.

Function: make-unknown-option-condition
Function: unknown-option-condition? obj

Constructor and predicate for &unknown-option condition objects.

Function: raise-unknown-option who brief/long argument message

Raise a continuable exception describing an “unknown option” error; the raised object is a compound condition with components of the following types: &who, &brief/long, &argument, &message.

Option requires value error

Condition Type: &option-requires-value

Condition type used to signal an “option requires value” error; it is derived from &getopts. It has no fields.

Function: make-option-requires-value-condition
Function: option-requires-value-condition? obj

Constructor and predicate for &option-requires-value condition objects.

Function: raise-option-requires-value who option argument message

Raise a continuable exception describing an “option requires value” error; the raised object is a compound condition with components of the following types: &who, &option, &argument, &message.

Option requires no value error

Condition Type: &option-requires-no-value

Condition type used to signal an “option requires no value” error; it is derived from &getopts. It has no fields.

Function: make-option-requires-no-value-condition
Function: option-requires-no-value-condition? obj

Constructor and predicate for &option-requires-no-value condition objects.

Function: raise-option-requires-no-value who option argument message

Raise a continuable exception describing an “option requires no value” error; the raised object is a compound condition with components of the following types: &who, &option, &argument, &message.

Invalid option error

Condition Type: &invalid-option

Condition type used to signal an “invalid option” error; it is derived from &getopts. It has no fields.

Function: make-invalid-option-condition
Function: invalid-option-condition? obj

Constructor and predicate for &invalid-option condition objects.

Function: raise-invalid-option who option argument message

Raise a continuable exception describing an “invalid option” error; the raised object is a compound condition with components of the following types: &who, &option, &argument, &message.


Previous: , Up: getopts   [Index]