Added stack trace.js and node stack trace definitions

This commit is contained in:
Blake Niemyjski
2015-05-12 11:45:03 -05:00
parent 846a250e0a
commit 433ed3d130
3 changed files with 92 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
// Type definitions for node-stack-trace
// Project: https://github.com/felixge/node-stack-trace
// Definitions by: [Exceptionless] <https://github.com/exceptionless>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module 'stack-trace' {
export interface StackFrame {
getTypeName():string;
getFunctionName():string;
getMethodName():string;
getFileName():string;
getTypeName():string;
getLineNumber():number;
getColumnNumber():number;
isNative():boolean;
}
export function get(belowFn:() => void): StackFrame[];
export function parse(err:Error): StackFrame[];
}
+8
View File
@@ -0,0 +1,8 @@
import stackTrace = require('stack-trace');
var currentStackTrace = stackTrace.get();
var err = new Error('something went wrong');
var trace = stackTrace.parse(err);
var fileName = trace[0].getFileName();