JSFiddle - React, Tailwind, and code Playground

by andypotanin

JavaScript

var ApplicationError = function (msg, data) {
    this.msg = msg;
    this.data = data;
}

ApplicationError.prototype = new Error();

var SystemError = function (msg, data) {
    this.msg = msg;
    this.data = data;
}

SystemError.prototype = new ApplicationError();

var app_error = new ApplicationError('hello');
var sys_error = new SystemError('hello');

console.log(app_error instanceof Error);
console.log(app_error instanceof ApplicationError);
console.log(sys_error instanceof Error);
console.log(sys_error instanceof SystemError);
console.log(sys_error instanceof ApplicationError);