Improve custom errors and log errors in all sample pages

This commit is contained in:
Tom Z?hner
2020-04-19 15:23:00 +02:00
parent 5887315221
commit 07f2cccca8
17 changed files with 106 additions and 73 deletions
Generated Vendored
+24 -7
View File
@@ -713,13 +713,30 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// tslint:disable-next-line:variable-name
var EMFJSError = function (message) {
this.name = "EMFJSError";
this.message = message;
this.stack = (new Error()).stack;
};
EMFJSError.prototype = new Error();
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var EMFJSError = /** @class */ (function (_super) {
__extends(EMFJSError, _super);
function EMFJSError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain
return _this;
}
return EMFJSError;
}(Error));
var isLoggingEnabled = true;
function loggingEnabled(enabled) {
isLoggingEnabled = enabled;
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+24 -7
View File
@@ -311,13 +311,30 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// tslint:disable-next-line:variable-name
var RTFJSError = function (message) {
this.name = "RTFJSError";
this.message = message;
this.stack = (new Error()).stack;
};
RTFJSError.prototype = new Error();
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var RTFJSError = /** @class */ (function (_super) {
__extends(RTFJSError, _super);
function RTFJSError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain
return _this;
}
return RTFJSError;
}(Error));
var isLoggingEnabled = true;
function loggingEnabled(enabled) {
isLoggingEnabled = enabled;
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+24 -7
View File
@@ -778,13 +778,30 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
// tslint:disable-next-line:variable-name
var WMFJSError = function (message) {
this.name = "WMFJSError";
this.message = message;
this.stack = (new Error()).stack;
};
WMFJSError.prototype = new Error();
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var WMFJSError = /** @class */ (function (_super) {
__extends(WMFJSError, _super);
function WMFJSError(message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype); // restore prototype chain
return _this;
}
return WMFJSError;
}(Error));
var isLoggingEnabled = true;
function loggingEnabled(enabled) {
isLoggingEnabled = enabled;
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+5 -2
View File
@@ -53,10 +53,13 @@ function displayWMF(blob) {
$("#tools").show();
console.log("All done!");
} catch(e) {
if (e instanceof WMFJS.Error)
if (e instanceof WMFJS.Error) {
$("#content").text("Error: " + e.message);
else
throw e;
}
else {
throw e;
}
}
}
function loadWmfFile(file) {
+5 -2
View File
@@ -55,10 +55,13 @@ function displayEMF(blob) {
$("#tools").show();
console.log("All done!");
} catch(e) {
if (e instanceof EMFJS.Error)
if (e instanceof EMFJS.Error) {
$("#content").text("Error: " + e.message);
else
throw e;
}
else {
throw e;
}
}
}
function loadEmfFile(file) {
+5 -13
View File
@@ -25,21 +25,13 @@ SOFTWARE.
*/
// tslint:disable-next-line:interface-name
export interface EMFJSError {
name: string;
message: string;
stack: string;
export class EMFJSError extends Error {
constructor(message: string) {
super(message); // 'Error' breaks prototype chain here
Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
}
}
// tslint:disable-next-line:variable-name
export const EMFJSError = function(this: EMFJSError, message: string) {
this.name = "EMFJSError";
this.message = message;
this.stack = (new Error()).stack;
} as any as new (message: string) => EMFJSError;
EMFJSError.prototype = new Error();
let isLoggingEnabled = true;
export function loggingEnabled(enabled: boolean) {
isLoggingEnabled = enabled;
+5 -13
View File
@@ -26,21 +26,13 @@ SOFTWARE.
import { IColor } from "./parser/destinations/ColortblDestinations";
// tslint:disable-next-line:interface-name
export interface RTFJSError {
name: string;
message: string;
stack: string;
export class RTFJSError extends Error {
constructor(message: string) {
super(message); // 'Error' breaks prototype chain here
Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
}
}
// tslint:disable-next-line:variable-name
export const RTFJSError = function(this: RTFJSError, message: string) {
this.name = "RTFJSError";
this.message = message;
this.stack = (new Error()).stack;
} as any as new (message: string) => RTFJSError;
RTFJSError.prototype = new Error();
let isLoggingEnabled = true;
export function loggingEnabled(enabled: boolean) {
isLoggingEnabled = enabled;
+5 -13
View File
@@ -24,21 +24,13 @@ SOFTWARE.
*/
// tslint:disable-next-line:interface-name
export interface WMFJSError {
name: string;
message: string;
stack: string;
export class WMFJSError extends Error {
constructor(message: string) {
super(message); // 'Error' breaks prototype chain here
Object.setPrototypeOf(this, new.target.prototype); // restore prototype chain
}
}
// tslint:disable-next-line:variable-name
export const WMFJSError = function(this: WMFJSError, message: string) {
this.name = "WMFJSError";
this.message = message;
this.stack = (new Error()).stack;
} as any as new (message: string) => WMFJSError;
WMFJSError.prototype = new Error();
let isLoggingEnabled = true;
export function loggingEnabled(enabled: boolean) {
isLoggingEnabled = enabled;