jsでエラーを継承する
var HogeError = function(){ Error.apply(this, arguments); }; HogeError.prototype = new Error; try { throw new HogeError(); } catch(e) { if (e instanceof HogeError) { console.log("success"); } else { console.log("failure"); } }
var HogeError = function(){ Error.apply(this, arguments); }; HogeError.prototype = new Error; try { throw new HogeError(); } catch(e) { if (e instanceof HogeError) { console.log("success"); } else { console.log("failure"); } }