Giter Site home page Giter Site logo

as3-airbrake's Introduction

AS3 Airbrake

This is an AirBrake URLRequest generator that uses either the XML or JSON interface to V3 of the Airbrake API

It is based around the IAirBrake interface so that you are not dependent on one API implementation or the other. They are all apart of the com.cleversoap.airbrake namespace and should be used in the following fashion:

var notifier:IAirBrake = new AirBrakeXML("your-api-key", "production");

or

var notifier:IAirBrake = new AirBrakeJSON("your-api-key", "production", #project-id);

After that all that's left to do is pass an Error object of any type to createErrorNotice like so:

var req:URLRequest = notifier.createErrorNotice(new Error());

Obviously you can put a caught Error there or any Error object aquired in any other fashion, try to get it as close to the actual issue though as its stack trace will be parsed for reporting and the accuracy of that data can be crucial. Once you have your URLRequest you can treat like it any other - load it with a URLLoader, for example. I made no assumptions about how you wanted to actually send the data once you have the URLRequest object so it can be inserted into any system.

Optional Parameters and URLs

In addition to handling Error objects each call to createErrorNotice can handle two additional (optional) arguments. The first is an object that contains keyed values, these are additional parameters that you feel are relevant to the error, eg. user id or browser type.

var req:URLRequest = notifier.createErrorNotice(new Error(), {"user-id": 12345, "browser": "Mozilla Something"};

The second optional parameter is the URL at which the error occurred. This value can usually be retrieved by doing the following (if you've embedded it in the browser):

ExternalInterface.call("eval", "window.location.href");

You can then use this value like so - note that the optional params here are null but obviously can be any value as I described before:

var req:URLRequest = notifier.createErrorNotice(new Error(), null, "http://example.com/error-maker");

Compiling

A Makefile has been included that, as long as you have the FlexSDK (compc specifically) accessible from the command line, you can run directly with make - it will output the swc to the bin directory. This is the same way that I build the swc for downloading.

Download

I've included a compiled SWC for ease of use here that can be easily included into your project.

License

MIT License

as3-airbrake's People

Contributors

cleversoap avatar welearnednothing avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.