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
{ {
this.name = "Fatal Error"; constructor( msg )
this.message = msg; {
super( msg );
var e = new Error(); this.name = "FatalError";
e = e.stack.split( "\n" ); }
e[0] = this.name;
e[1] = msg;
this.stack = e.join( "\n" );
} }
error.prototype.toString = function() module.exports = FatalError;
{
return this.name + " " + this.message;
}
module.exports = error;