![]() |
![]()
| ![]() |
![]()
NAMEOpenAI::API::Error - throwable error objects SYNOPSISuse OpenAI::API::Error; OpenAI::API::Error->throw( message => 'Something went wrong', request => $req, response => $res, ); # elsewhere... try { my $response = $openai->$method(...); } catch ($e) { # Handle error } DESCRIPTIONThe "OpenAI::API::Error" module provides an object-oriented exception mechanism for errors encountered while interacting with the OpenAI API. It extends the Throwable::Error class to include the optional HTTP::Request and HTTP::Response objects, allowing for better error reporting and debugging. ATTRIBUTESrequestThe "request" attribute holds the HTTP::Request object associated with the error. responseThe "response" attribute holds the HTTP::Response object associated with the error. METHODSthrowThe "throw" method creates a new OpenAI::API::Error object with the provided message, request, and response attributes and throws it as an exception. SEE ALSO
|