Skip to content
virtuo edited this page Sep 14, 2010 · 2 revisions

All errors are created by a POST request to the url /errors/

Parameters

In your request, you can define the following parameters:

  • ‘api-key’
  • ‘version’
  • ‘error’
    • ‘message’
    • ‘raised_at’
    • ‘backtrace’
    • ‘request’
    • ‘session’
    • ‘environment’
    • ‘data’

Mandatory

Are only mandatory :

  • ‘raised_at’
  • ‘message’

Format

All data are String, but can be Array or Hash too. The list of format are :

  • ‘api-key’ => STRING, the api-key of project
  • ‘version’ => STRING, actually 0.1.0 but can change in future.
  • ‘error’ => HASH, it’s an hash with all information about error raised, all keys are define like after
    • ‘raised_at’ => STRING, date with error is raised in application, use UTC date
    • ‘backtrace’ => Array, it’s a list of string where each string is a line of backtrace
    • ‘request’ => Hash, All information about request
    • ‘session’ => Hash
    • ‘environment’ => Hash, All information about environment where error raised
    • ‘data’ => Hash, What you want.

Exemple of Hash sent by POST

{'api_key' => "123e435",
    'version' => '0.1.0',
    'error' => {'message' => 'Mongo::OperationFailure: Invalid dbref/code/string/symbol size',
      'raised_at' => '2008-07-09T20:06:44-07:00',
      'backtrace' =>["[GEM_ROOT]/gems/mongo-0.18.3/lib/../lib/mongo/cursor.rb:73:in `next_document'",
                            "[GEM_ROOT]/gems/mongo-0.18.3/lib/../lib/mongo/db.rb:395:in `command'",
                            "[GEM_ROOT]/gems/mongo-0.18.3/lib/../lib/mongo/cursor.rb:95:in `count'",
                            "[GEM_ROOT]/gems/mongo_mapper-0.7.0/lib/mongo_mapper/document.rb:106:in `"],
      'request' => {
        'rails_root' => '/path/to/project',
        'url' => 'http://localhost/failure?id=123',
        'params' => {
          'action' => 'index',
          'id' => '123',
          'controller' => 'groups'}},
      'environment' => {
        'SERVER_NAME' => 'localhost',
        'HTTP_ACCEPT_ENCODING' => 'gzip,deflate',
        'HTTP_USER_AGENT' => 'Mozilla/5.0',
        'PATH_INFO' =>  '/',
        'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5',
        'HTTP_HOST' => 'localhost'},
      'data' => {}}}

Parameters

Parameters of you request are defined in key [‘request’][‘params’]

URL

The url is sent by key [‘request’][‘url’]

Returned information

  • If the post works a HTTP code 200 is returned.
  • If the post has some error on its formatting, the return HTTP code is 422. An Array of all errors reported are sent in the body.
  • If the API is unknown or malformed, the HTTP code is 404
Clone this wiki locally