HTTP::OAI::Error(3pm)
π HTTP::OAI::Error π
okay so bestie, welcome to HTTP::OAI::Error β she's the little Perl module (you'll find her hanging out in the User Contributed Perl Documentation section of your manual, section 3pm obviously π ) whose whole entire job is encapsulating OAI error codes. that's it. that's the gig. she holds the error code and the error message so you don't have to π«Ά
β¨ METHODS β¨
$err = new HTTP::OAI::Error(code=>'badArgument',[message=>'An incorrect argument was supplied'])β this constructor method returns a newHTTP::OAI::Errorobject. iconic behaviour honestly π
and here's the cute part: if you don't pass in a message, and the code happens to be a valid OAI error code, then the default message is the appropriate message from the OAI protocol document. so she'll fill in the blanks for you, no cap. π
$code = $err->code([$code])β returns the error name, and optionally sets it if you hand her a$code. get it, set it, slay π$msg = $err->message([$msg])β returns the error message, and optionally sets it if you hand her a$msg. same energy, different field π¦
π¨ NOTE β noRecordsMatch π¨
okay this one is the plot twist, so listen up fr fr:
noRecordsMatch, without additional errors, is not treated as an error code. like, she refuses to be dramatic about it π
so if a repository returns noRecordsMatch, the HTTP::OAI::Response object will have a verb of 'error' and will contain the noRecordsMatch error β BUT β is_success will still return true. yes bestie, both things at once. it's giving "technically an error, emotionally a success" π
e.g.
my $r = $ha->ListIdentifiers(metadataPrefix='oai_dc',from=>'3000-02-02');
if( $r->is_success ) {
print "Successful\n";
} else {
print "Failed\n";
}
print $r->verb, "\n";
this will print "Successful" followed by "error". and yes that's the whole point, that's the vibe check, that's the demo. β
and that's the whole page, bestie π this was perl v5.36.0, dated 2023-09-28, and she's filed under HTTP::OAI::Error(3pm) β go forth and handle your errors with main character energy πβ¨πΈ
π¦ where this page comes from
- debian trixie: libhttp-oai-perl 4.13-1 Β· BSD-3-Clause
- ubuntu noble: libhttp-oai-perl 4.13-1 Β· BSD-3-Clause
- ubuntu resolute: libhttp-oai-perl 4.13-1 Β· BSD-3-Clause
- ubuntu stonking: libhttp-oai-perl 4.13-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms