UNPKG

@wishcbg/bobcode

Version:

基於店家同步功能的需求,讓店家能夠在不同的店家之間同步各項功能設定,並且能夠檢視各項功能的異動情況。 規劃出一套店家設定即程式碼的機制,讓店家能夠以 config file (.sac) 來定義各項功能設定,並且能夠還原店家各項功能設定。 暫且稱這個機制為「Settings as Code」「店家設定即程式碼」。

29 lines (28 loc) 1.18 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ThirtdPartyError = exports.BadRequestError = void 0; const http_1 = require("http"); class BadRequestError extends Error { constructor(message = http_1.STATUS_CODES[400] || 'Bad Request', errorCode) { super(message); // 修正 ES6 subclassing Error 的原型鏈 Object.setPrototypeOf(this, BadRequestError.prototype); this.errorCode = errorCode ?? null; this.statusCode = 400; this.name = this.constructor.name; Error.captureStackTrace(this, this.constructor); } } exports.BadRequestError = BadRequestError; class ThirtdPartyError extends Error { constructor(message = http_1.STATUS_CODES[502] || 'Bad Gateway', origin, errorCode) { super(`${origin} error: ${message}`); // 修正 ES6 subclassing Error 的原型鏈 Object.setPrototypeOf(this, BadRequestError.prototype); this.errorCode = errorCode ?? null; this.statusCode = 502; this.name = this.constructor.name; Error.captureStackTrace(this, this.constructor); } } exports.ThirtdPartyError = ThirtdPartyError;