VM::EC2::Error(3pm)
π VM::EC2::Error π
okay so bestie, welcome to VM::EC2::Error β the Perl doc for the object that describes an error emitted by the Amazon API. it lives in the User Contributed Perl Documentation section, and honestly? it's giving "small file, big feelings" energy. π
β¨ NAME β¨
VM::EC2::Error β the object that's literally just here to describe an error emitted by the Amazon API. no cap. that's the whole job. π
πΈ SYNOPSIS πΈ
like, here's the vibe in code form:
use VM::EC2;
$ec2 = VM::EC2->new(...);
$instance = $ec2->describe_instance(-instance_id=>'invalid-name');
die $ec2->error if $ec2->is_error;
see how it goes? you make your $ec2, you ask for an instance with an ID that is absolutely not valid, and then you check $ec2->is_error and die with the error. iconic behavior, honestly. π«Ά
π¦ DESCRIPTION π¦
so this object represents an error emitted by the Amazon API. periodt.
here's the part you actually need to internalize: VM::EC2 method calls can return undef under either of two conditions, and these two things are NOT the same thing, bestie:
- the request might just simply have no results that satisfy it β for example, asking to describe an instance whose ID does not exist. nothing broke, there's just... nothing there. π
- an error occurred due to invalid parameters or communication problems. this one is the actual "something went wrong" situation. π
and as described in VM::EC2, here's the dynamic duo you'll be using:
VM::EC2->is_errorreturns true if the last method call resulted in an error.VM::EC2->errorreturns the content of the error message.
so check is_error first, then grab the goods with error. iykyk. β¨
π METHODS π
these object methods are supported, and there are exactly two of them, so no excuses:
messageβ the error message. the actual words of what went wrong. π¬codeβ the error code. the little categorical tag for it. π·οΈ
π STRING OVERLOADING π
okay this part is lowkey delightful: when you use this object in a string context, it will interpolate the code and the message into a single string, in this exact format:
"Message [Code]"
so it just shows up looking cute and readable wherever you shove it into a string. no extra work from you. main character energy. π
π§ SEE ALSO π§
go read these too, they're the friend group:
VM::EC2VM::EC2::Generic
π AUTHOR π
Lincoln Stein <lincoln.stein@gmail.com>.
Copyright (c) 2011 Ontario Institute for Cancer Research
and here's the legal bit, fr fr β this package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. refer to LICENSE for the full license text. in addition, please see DISCLAIMER.txt for disclaimers of warranty. π«Ά
okay bestie that's the whole page, go forth and checkis_errorbefore youdieπ
mwah β this lil rewrite is running on perl v5.38.2, dated 2024-08-10, and yeah that's VM::EC2::Error(3pm) signing off. slay. β¨π
π
π¦ where this page comes from
- debian trixie: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 OR GPL-1.0-or-later
- ubuntu resolute: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 OR GPL-1.0-or-later
- ubuntu stonking: libvm-ec2-perl 1.28-5 Β· Artistic-2.0 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