File::...::Error(3pm)
π NAME π
okay so this is File::KDBX::Error from the User Contributed Perl Documentation, aka the File::...::Error(3pm) page, and it is literally just an object that represents something bad that happened. that's the whole assignment. it's giving emotional support exception. π«Ά
β¨ VERSION β¨
version 0.906 β tiny number, big responsibility π
π ATTRIBUTES π
the lil built-in facts every error object carries around with it, like a wallet full of receipts π§
details
\%details = $error->details;
get the error details. that's it, that's the tea π
errno
get the value of errno at the exact moment the exception was created. like a timestamp but for system errors, no cap.
previous
get the value of $@ (i.e. latest exception) at the time this exception was created. yes bestie it remembers the drama that came before it π iconic behaviour honestly.
trace
get a stack trace indicating where in the code the exception was created. it's giving "here is exactly who did this to you" π
type
get the exception type, if any. sometimes there's just no type and that's fine, we don't judge πΈ
π₯ METHODS π₯
new
$error = File::KDBX::Error->new($message, %details);
construct a new error. brand new, fresh out the box, main character energy β¨
error
$error = error($error);
$error = error($message, %details);
$error = File::KDBX::Error->error($error);
$error = File::KDBX::Error->error($message, %details);
wrap a thing to make it an error object. if the thing is already an error, it just gets returned as-is (no notes, periodt). otherwise, whatever you passed gets forwarded to new to create a new error object.
this is so convenient for error handling when you're not sure what the exception is but you wanna treat it as a File::KDBX::Error. example:
eval { ... };
if (my $error = error(@_)) {
if ($error->type eq 'key.missing') {
handle_missing_key($error);
}
else {
handle_other_error($error);
}
}
to_string
$message = $error->to_string;
$message = "$error";
stringify an error π
heads up bestie: this does not contain a stack trace. but you can set theDEBUGenvironment variable to at least2to stringify the whole entire error object. iykyk π
throw
File::KDBX::Error::throw($message, %details);
$error->throw;
throw an error. yeet. π€π₯
warn
File::KDBX::Error::warn($message, %details);
$error->warn;
log a warning. softer than throw, still loud enough to be heard π
alert
alert $error;
importable alias for warn. same vibe, different name, we love a rebrand π
π BUGS π
please report any bugs or feature requests on the bugtracker website <https://github.com/chazmcgarvey/File-KDBX/issues>
when submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. fr fr, a lil repro helps everyone π₯Ί
π AUTHOR π
Charles McGarvey <ccm@cpan.org>
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2022 by Charles McGarvey.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay bye bestie π¦ this was File::...::Error(3pm) from perl v5.40.1, dated 2025-05-04 β thanks for coming to my ted talk, slay, and remember: when something bad happens, at least it's an object now. π
β¨
π¦ where this page comes from
- debian trixie: libfile-kdbx-perl 0.906-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libfile-kdbx-perl 0.906-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libfile-kdbx-perl 0.906-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms