This is the node.js client library for http://yellerapp.com. It lets you automatically detect errors in your application, and reports them via Yeller's API, so you can debug and fix them quickly.
Install Yeller from npm:
npm install yeller_node
var yeller = require('yeller_node')
var yellerClient = yeller.client({token: 'YOUR_API_TOKEN_HERE'})
yellerClient.report(new Error('an message'));
Often you'll want to include more information about what was going on when the error happened
yellerClient.report(new Error('an message'),
{location: 'myhandler', url: 'http://example.com'
customData: {userID: 1}});
report
Here are the available options that you can pass to report
to give additional information:
location
: the name of what kind of program was running when this error happened. For http requests, this might be the name of the handler, for background jobs, the name of the job, etcurl
(http only): the url of the http request that caused this errorcustomData
: this is an arbitrary JSON hash of any information you want to send along with the error. Typical suspects: http params, http session, current job params, data about the currently logged in user, etcclient
Alongside options to report, you can pass some other options to client
:
applicationEnvironment
: a string that denotes what kind of environment the application is running in. This defaults to production
, but you might want to change it to staging
, development
, or test
etcdevelopmentEnvironments
: an array of environments in which yeller should ignore errors. This lets you use yeller in your production code without it reporting errors when your tests fail etc.host
: a string that denotes which server the error happened on. By default yeller_node
reads this from os.hostname
.var yellerClient = yeller.client(
{
token: 'YOUR_API_TOKEN_HERE',
applicationEnvironment: "staging",
developmentEnvironments: ["dev"],
host: "myapp.com"
}
)
yeller_node
(like all other supported yeller clients) does smart retrying when nodes fail- so if one of yeller's backend servers is down, you won't lose errors.
For detecting when an error happens whilst yeller is reporting an error, you can pass errorHandler
to client
like so:
var errorHandler = {
ioError: function (err) {
console.log(err);
},
authError: function (err) {
console.log(err);
},
};
var yellerClient = client({
token: 'YOUR_API_TOKEN_HERE',
errorHandler: errorHandler
});
This will log yeller errors to stdout. ioError
happens when there's a failure talking to yeller's backend, authError
happens when your yeller API token is invalid.
This library doesn't support the standard http proxy environment variables, because the standard library's https.request
doesn't support them. If you're getting issues trying to send via an http proxy, please remove the environment variables and try again.
If you have any questions, feel free to shoot me an email, .
If you're curious about this library, it's open source, and available on: github