Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

errorhandlr

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

errorhandlr - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

Makefile

59

lib/errorhandlr.js
var printStackTrace = require('stacktrace-js')
, util = require('util');
, util = require('util')
, package = require('../package.json')
, keen = require('keen.io');
var keen = keen.configure({
projectId: '526e157c05cd6660e8000000',
writeKey: 'd4921aec11dc77b09c6523acf65e444462eee8078bd3ddce494fd8563a9b75ff49b4ee3845b920f71506fccdd5c00a22635d5e5fa8aa18c6fd55425b7da353db8fa39dcfcef933aaf3fc46b53caa85db2c3d4b2ba4af1efb68e0f80d6b251dba43f73405f5b21552bb95e2766eeba4da'
});
function ErrorHandlr(options) {

@@ -16,3 +23,3 @@ var self = this;

var self = this
, trace = err.stack || self._buildTrace(err);
, trace;

@@ -23,11 +30,15 @@ if (!(err instanceof Error)) {

self.log(trace);
self.log("\nhttp://google.com/foobar\n");
trace = err.stack || self._buildTraceString(err);
if(die) {
process.exit(1);
}
self._logError(err, function() {
self.log(trace);
if(die) {
process.exit(1);
}
});
};
ErrorHandlr.prototype._buildTrace = function(err) {
ErrorHandlr.prototype._buildTraceString = function(err) {
var trace = printStackTrace({ e: err });

@@ -41,2 +52,34 @@ return err.name + ": " + err.message + "\n " + trace.join("\n ");

ErrorHandlr.prototype._logError = function(err, cb) {
var trace = printStackTrace({ e: err })
, os = require("os")
, data = {
name: err.name,
message: err.message,
trace: trace,
env: {
name: package.name,
version: package.version,
nodeVersion: process.version,
hostName: os.hostname(),
author: package.author,
nodeDependencies: JSON.stringify(package.dependencies),
nodeDevDependencies: JSON.stringify(package.devDependencies)
}
};
keen.addEvent("error-" + package.version, data, function(keenErr, keenRes) {
if(keenErr) {
console.error("\n****************************************");
console.error("An Unexpected Error Reporting Occured!");
console.error("Please report the following to Swift:\n");
console.error(keenErr + "\n");
console.error(JSON.stringify(data, undefined, 2) + "\n");
console.error("****************************************");
}
cb();
});
};
module.exports = new ErrorHandlr();

11

package.json
{
"name": "errorhandlr",
"version": "0.0.0",
"version": "0.0.1",
"description": "Secret sauce.",
"main": "lib/errorhandlr.js",
"dependencies": {
"stacktrace-js": "~0.5.0"
"stacktrace-js": "~0.5.0",
"keen.io": "0.0.3"
},
"devDependencies": {},
"devDependencies": {
"mocha": "~1.13.0",
"expect.js": "~0.2.0",
"sinon": "~1.7.3"
},
"scripts": {

@@ -11,0 +16,0 @@ "test": "make test"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc