CAF::Exception¶
NAME¶
CAF::Exception - provides basic methods for failure and exception handling
Private methods¶
- _get_noaction
Return NoAction setting:
- Return 0 is
keeps_state
is trueAny other value ofkeeps_state
is ignored. (In particular, you cannot usekeeps_state
to enable NoAction).
- Return value of
noAction
method (when defined)CAF::Object::NoAction
otherwiseSupports an optional
msg
that is prefixed to reporter.
- _reset_exception_fail
Reset previous fail attribute and/or exception.
msg
is a suffix when reporting the oldfail
attribute and/or exception error (with debug level 1).
EC
is aLC::Exception::Context
instance that is checked for an existing error, which is set to ignore if it exists.Always returns SUCCESS.
- _function_catch
Execute function reference
funcref
with arrayref$args
and hashref$opts
.Method resets any existing fail attribute and error from
LC::Exception::Context
instanceEC
.When an exception thrown is thrown, it is catched and reset. No error is reported and undef is returned in this case and the fail attribute is set with the exception error text.
- _safe_eval
Run function reference
funcref
with arrayrefargsref
and hashrefoptsref
.Return and set fail attribute with
failmsg
($@
is added when set) on die or in case of an error (undef
returned byfuncref
). In case of success, reportmsg
(stringified result is added unlesssensitive
attribute is set) at verbose level.Note that
_safe_eval
doesn’t work with functions that don’t return a defined value when they succeed.Resets previous fail attribute and or exceptions (via the
LC::Exception::Context
instanceEC
).