Giter VIP home page Giter VIP logo

airbrake-dotnet's Introduction

#airbrake-dotnet

This is a .NET library which allows you to report exceptions using the Airbrake API. aTech Media uses this to report errors to projects in Codebase.

Once included in a project, a call to report an exception can be placed in any "Catch" block or used as a global error reporting tool.

##Installing

Include the 'airbrake' project in your solution and add a reference to it. Alternatively, compile it then include and reference the DLL.

Next include the namespace in the file in which you are handling your exceptions:

C#

using airbrake;

VB.NET

Imports airbrake

##Usage

To use airbrake-dotnet, you will need an API key and some information about the endpoint.

###Step 1 - Initialisation

The initialiser for the class takes the following parameters:

  • bool ssl - Should connections to the endpoint use HTTPS?
  • string host - The hostname of the endpoint
  • string path - Path to the Airbrake API
  • string apikey - The API key for your applications
  • string environment - An environment name to identify this application/environment

If you are reporting exceptions to Codebase, you might initialise the library with the following code:

ExceptionHandler handler = new ExceptionHandler(true, "exceptions.codebasehq.com", "/notifier_api/v2/notices", "MY-API-KEY", "WindowsProduction");

###Step 2 - Reporting errors

Now that the error handler is ready to use, you can report errors like so:

handler.Send(ex)

##Full Example

public bool doSomething()
{
    try
    {
        //My risky code here
        return true;
    }
    catch (Exception ex)
    {
        ExceptionHandler handler = new ExceptionHandler(true, "exceptions.codebasehq.com", "/notifier_api/v2/notices", "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", "WindowsProduction");
        handler.Send(ex);
        return false;
    }
}

airbrake-dotnet's People

Contributors

vcazan avatar jackhayter 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.