NAME

Getopt::Pad::Error - The exception for user errors (internal)

DESCRIPTION

This module is internal to Getopt::Pad. It is not part of the public API and can change without notice. Programs use "GetOptions" in Getopt::Pad; this page is for people working on Getopt::Pad itself.

The exception thrown for every mistake on the command line or in a config file. GetOptions catches it, prints ERROR: MESSAGE and the help text of the level it belongs to to STDERR, and exits with status 2. Spec errors are not Getopt::Pad::Error objects; they are plain die messages.

METHODS

throw($format, @args)

Class method. Throws a new error whose message is sprintf($format, @args).

message

The message. The object also stringifies to it.

level

The spec level the error belongs to, or undef.

attachContext($level)

Sets the level if none is set yet, and returns the error. The parser calls it while the exception passes through; the first level set is kept.

SEE ALSO

"ERRORS AND EXIT STATUS" in Getopt::Pad, Getopt::Pad::ExitRequest

AUTHOR

davenonymous <perl@davenonymous.com>

COPYRIGHT AND LICENSE

Copyright 2026 davenonymous

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.