Search...:Error(3pm)
β¨ Search::Elasticsearch::Error β the tea on errors β¨
okay so bestie, this is the page for Search...:Error(3pm), which lives in the Perl user-contributed docs, and it's literally all about the error objects that Search::Elasticsearch throws at you when things go sideways. π
π VERSION
version 8.12 β yes she's on 8.12, periodt.
π¦ DESCRIPTION
So here's the vibe: errors thrown by Search::Elasticsearch aren't just sad little strings, they're error objects. That means they can carry a whole stack trace plus extra info to help you debug what went wrong. Main character energy for an exception, honestly.
An error object is made up of this:
{
type => $type, # eg Missing
text => 'Error message',
vars => {...}, # vars which may help to explain the error
stack => [...], # a stack trace
}
Also!! There's a $Search::Elasticsearch::Error::DEBUG variable and you can set it to 1 or 2 if you want your errors to be more verbose. Turn it up, get more detail. Slay. π₯
Error objects also stringify into a human readable error message whenever they're used in text context (for example: "print 'Oh no! '.$error"). And they support the TO_JSON method so they can get converted to JSON when convert_blessed in JSON is enabled. Versatile queen. β¨
π ERROR CLASSES
These are all the error classes that are defined, and bestie, there are a lot of them:
Search::Elasticsearch::Error::Paramβ a bad parameter got passed to a method. Rude of you tbh. πSearch::Elasticsearch::Error::Requestβ something generically went wrong while doing your request in Elasticsearch. This one gets triggered by HTTP status codes400and500. And she has sub-classes, of course she does:Search::Elasticsearch::Error::Unauthorizedβ invalid (or just plain missing) username/password given as"userinfo"for a password protected service. Triggered by the401HTTP status code.Search::Elasticsearch::Error::Missingβ the resource you asked for was not found. Triggered by the404HTTP status code.Elastisearch::Error::Conflictβ your request couldn't be performed because of some conflict. Like, say you try to delete a document with a particular version number but the document already changed β boom, you get aConflicterror. If it can, it'll include thecurrent_versionin the error vars. This one is triggered by the409HTTP status code.Search::Elasticsearch::Error::ContentLengthβ the request body was longer than the max_content_length. Too much. πSearch::Elasticsearch::Error::RequestTimeoutβ the request took longer than the specified"timeout". Currently this only applies to the cluster_health request.
Search::Elasticsearch::Error::Timeoutβ the request timed out. She simply could not wait any longer. β°Search::Elasticsearch::Error::Cxnβ there was an error connecting to a node in the cluster. This one means node failure, and it will get retried on another node. She's got sub-classes too:Search::Elasticsearch::Error::Unavailableβ the current node can't handle your request right now, so your request gets retried on another node. Triggered by the503HTTP status code.Search::Elasticsearch::Error::BadGatewayβ a proxy sitting between the client and Elasticsearch can't connect to Elasticsearch. Triggered by the502HTTP status code.Search::Elasticsearch::Error::GatewayTimeoutβ a proxy between the client and Elasticsearch can't connect to Elasticsearch within its own timeout. Triggered by the504HTTP status code.Search::Elasticsearch::Error::SSLβ there was a problem validating the SSL certificate. Heads up: not all backends support this error type. π«Ά
Search::Elasticsearch::Error::Forbiddenβ either the cluster couldn't process the request because it's currently blocking (like, there aren't enough master nodes to form a cluster), or the authenticated user is trying to do an unauthorized action. Triggered by the403HTTP status code.Search::Elasticsearch::Error::Illegalβ you attempted an illegal operation. For instance, you tried to use a Scroll helper in a different process after forking. Not the move. πSearch::Elasticsearch::Error::Serializerβ there was an error serializing a variable or deserializing a string.Elasticsarch::Error::Internalβ an internal error occurred, so please report this as a bug in this module. Tell the devs!! π
πΈ AUTHOR
Enrico Zimuel <enrico.zimuel@elastic.co> β thank you king π
π COPYRIGHT AND LICENSE
This software is Copyright (c) 2024 by Elasticsearch BV.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
and that's the whole page bestie, no cap. go forth and catch your errors with grace. πβ¨
perl v5.38.2 Β· 2024-02-04 Β· Search...:Error(3pm) β mwah, bye! π
ππ¦
π¦ where this page comes from
- debian trixie: libsearch-elasticsearch-perl 8.12-1 Β· Apache-2.0
- ubuntu noble: libsearch-elasticsearch-perl 8.12-1 Β· Apache-2.0
- ubuntu resolute: libsearch-elasticsearch-perl 8.12-1 Β· Apache-2.0
- ubuntu stonking: libsearch-elasticsearch-perl 8.12-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms