FatalError extends Error

This commit is contained in:
斟酌 鵬兄 2016-02-13 05:09:29 +08:00
parent 0c64766ae0
commit 5b5f4ccd24

View File

@ -1,19 +1,12 @@
function error( msg )
"use strict";
class FatalError extends Error
{
constructor( msg )
{
super( msg );
this.name = "FatalError";
this.message = msg;
var e = new Error();
e = e.stack.split( "\n" );
e[0] = this.name;
e[1] = msg;
this.stack = e.join( "\n" );
}
}
error.prototype.toString = function()
{
return this.name + " " + this.message;
}
module.exports = error;
module.exports = FatalError;