Properly extend Error instead of implementing it, update the Error message and stack to appear in the console and error activity

This commit is contained in:
Panayot Cankov
2016-12-01 09:03:40 +02:00
committed by Vladimir Enchev
parent bc3910f9c8
commit 89ee3dc717
7 changed files with 97 additions and 120 deletions

View File

@@ -43,35 +43,15 @@ declare module "utils/debug" {
/**
* An Error class that provides additional context to an error.
*/
export class ScopeError implements Error {
export class ScopeError extends Error {
/**
* Creates a new ScopeError providing addtional context to the child error.
* @param child The child error to extend.
* @param message Additional message to prepend to the child error.
*/
constructor(child: Error, message?: string);
/**
* Gets the child error.
*/
child: Error;
/**
* Gets the error message.
*/
message: string;
/**
* Gets the stack trace.
*/
stack: string;
/**
* Gets the error name.
*/
name: string;
}
/**
* Represents a scope error providing addiot
*/
@@ -83,10 +63,5 @@ declare module "utils/debug" {
* @param message Additonal message to prepend along the source location and the child error's message.
*/
constructor(child: Error, source: Source, message?: string);
/**
* Gets the error source.
*/
source: Source;
}
}
}