NAME
WebService::Raygun::Messenger - Communicate with the Raygun.io endpoint.
SYNOPSIS
use Try::Tiny;
use WebService::Raygun::Messenger;
sub some_code {
try {
# Code that throws an exception
# ...
}
catch {
my $exception = $_;
my $message = {
error => $exception, # $@ or framework exception (eg. Moose::Exception)
request => $request_object, # i.e. HTTP::Request, Catalyst::Request, etc.
#... other params
};
# initialise raygun.io messenger
my $raygun = WebService::Raygun::Messenger->new(
api_key => '<your raygun.io api key>',
message => $message
);
# send message to raygun.io
my $response = $raygun->fire_raygun;
};
}
DESCRIPTION
Send a request to raygun.io.
WebService::Raygun::Messenger, as well as most of the other classes in this package, accepts a HASHREF
in the constructor which is then coerced into datatypes that will eventually be sent to Raygun. It is generally not necessary to initialise any of these objects yourself. For the most part, the class hierarchy in this package maps to the API shown on the Raygun api docs.
INTERFACE
api_key
Your raygun.io API key. By default, this will be whatever is in the RAYGUN_API_KEY
environment variable.
message
This can be one of the following
HASHREF
-
{ occurred_on => '2014-06-27T03:15:10+1300', error => $error_obj, # eg. Catalyst::Exception, Moose::Exception user => 'test@test.com', environment => { processor_count => 2, cpu => 34, architecture => 'x84', total_physical_memory => 3 ... }, request => $request_object }
- WebService::Raygun::Message
-
The
HASHREF
with the structure above will be coerced into this type of object. See WebService::Raygun::Message for a more detailed description of this object.
fire_raygun
Send data to api.raygun.io/entries via a POST request.
SEE ALSO
- WebService::Raygun::Message
-
Constructs the actual message. See this class for a better description of the fields available or required for the raygun.io API.