@merkur/plugin-error 0.37.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.umd.js +1 -1
  2. package/package.json +4 -4
package/lib/index.umd.js CHANGED
@@ -1 +1 @@
1
- function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},r(t)}!function(r,t){if("function"==typeof define&&define.amd)define("@merkur/plugin-error",["exports","@merkur/core"],t);else if("undefined"!=typeof exports)t(exports,require("@merkur/core"));else{var e={exports:{}};t(e.exports,r.Merkur.Core),r.Merkur=r.Merkur||{},r.Merkur.Plugin=r.Merkur.Plugin||{},r.Merkur.Plugin.Error=e.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(t,e){Object.defineProperty(t,"__esModule",{value:!0}),t.GenericError=t.ERROR_EVENTS=void 0,t.errorPlugin=function(){return{setup:function(r){return s((function*(){return r.error=r.error?r.error:{status:null,message:null},r}))()},create:function(r){return s((function*(){if(d===v){if(!r.$in.component)throw new Error("You must install missing plugin: npm i @merkur/plugin-component");if(!r.$in.eventEmitter)throw new Error("You must install missing plugin: npm i @merkur/plugin-event-emitter")}return(0,e.hookMethod)(r,"info",E),(0,e.hookMethod)(r,"load",O),(0,e.hookMethod)(r,"mount",P),(0,e.hookMethod)(r,"update",_),r}))()}}},t.renderContent=N,t.setErrorInfo=R;var n=["status"];function o(r){return function(r){if(Array.isArray(r))return i(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||function(r,t){if(r){if("string"==typeof r)return i(r,t);var e={}.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(r,t):void 0}}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=Array(t);e<t;e++)n[e]=r[e];return n}function u(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function a(r,t,e){return(t=l(t))in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function c(r,t,e,n,o,i,u){try{var a=r[i](u),c=a.value}catch(r){return void e(r)}a.done?t(c):Promise.resolve(c).then(n,o)}function s(r){return function(){var t=this,e=arguments;return new Promise((function(n,o){var i=r.apply(t,e);function u(r){c(i,n,o,u,a,"next",r)}function a(r){c(i,n,o,u,a,"throw",r)}u(void 0)}))}}function f(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,l(n.key),n)}}function l(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}function p(t,e,n){return e=h(e),function(t,e){if(e&&("object"==r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(r){if(void 0===r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}(t)}(t,y()?Reflect.construct(e,n||[],h(t).constructor):e.apply(t,n))}function y(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(r){}return(y=function(){return!!r})()}function h(r){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},h(r)}function b(r,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,t){return r.__proto__=t,r},b(r,t)}function m(r){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!(this instanceof m))throw new TypeError("Cannot call a class as a function");if(this.constructor===m)throw new TypeError("The ExtensibleError is an abstract class and must be extended before it can be instantiated.");Error.call(this,r),this.name=this.constructor.name,this.message=r,this._nativeError=new Error(r),this._nativeError.name=this.name,this._nativeError.columnNumber&&(this.lineNumber=this._nativeError.lineNumber,this.columnNumber=this._nativeError.columnNumber,this.fileName=this._nativeError.fileName),this._stack=null,this._dropInternalStackFrames=t}m.prototype=Object.create(Error.prototype),m.prototype.constructor=m,Object.defineProperty(m.prototype,"stack",{configurable:!0,enumerable:!1,get:function(){if(this._stack)return this._stack;var r=this._nativeError.stack;if("string"==typeof r){if(this._dropInternalStackFrames){for(var t=r.split("\n"),e=1,n=Object.getPrototypeOf(this);n!==m.prototype;)n=Object.getPrototypeOf(n),e++;t.splice(1,e),this._stack=t.join("\n")}else this._stack=r;return this._stack}}});t.GenericError=function(r){function t(r,e){var o;!function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),o=p(this,t,[r]);var i=e.status,u=void 0===i?500:i,a=function(r,t){if(null==r)return{};var e,n,o=function(r,t){if(null==r)return{};var e={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(t.includes(n))continue;e[n]=r[n]}return e}(r,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(n=0;n<i.length;n++)e=i[n],t.includes(e)||{}.propertyIsEnumerable.call(r,e)&&(o[e]=r[e])}return o}(e,n);return o.name="Error",o.status=u,o._params=a,o}return function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),t&&b(r,t)}(t,r),e=t,(o=[{key:"params",get:function(){return this._params}}])&&f(e.prototype,o),i&&f(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,o,i}(m);var v="development",d="undefined"!=typeof process&&process&&process.env?process.env.NODE_ENV:v,g=t.ERROR_EVENTS={ERROR:"@merkur/plugin-error.error"};function O(r,t){return w.apply(this,arguments)}function w(){return w=s((function*(r,t){var e={};if(r.error.status)return e;try{for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];e=yield t.apply(void 0,o)}catch(t){t.status=t.status||500,R(r,t),M(r,t)}return e})),w.apply(this,arguments)}function E(r,t){return j.apply(this,arguments)}function j(){return j=s((function*(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];var i=yield t.apply(void 0,n);return function(r){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?u(Object(e),!0).forEach((function(t){a(r,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):u(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}({error:r.error},i)})),j.apply(this,arguments)}function P(r,t){return k.apply(this,arguments)}function k(){return k=s((function*(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];return N(r,t,n)})),k.apply(this,arguments)}function _(r,t){return S.apply(this,arguments)}function S(){return S=s((function*(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];return N(r,t,n)})),S.apply(this,arguments)}function R(r,t){r.error.status=t.status,r.error.message=t.message,r.error.url=t.params&&t.params.url,d===v&&(r.error.stack=t.stack)}function M(r,t){r.emit(g.ERROR,{error:t})}function N(r,t,e){return T.apply(this,arguments)}function T(){return(T=s((function*(r,t,e){if(r.error.status)try{return yield t.apply(void 0,o(e))}catch(r){return""}try{return yield t.apply(void 0,o(e))}catch(n){return n.status=n.status||500,R(r,n),M(r,n),N(r,t,e)}}))).apply(this,arguments)}}));
1
+ function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},r(t)}!function(r,t){if("function"==typeof define&&define.amd)define("@merkur/plugin-error",["exports","@merkur/core"],t);else if("undefined"!=typeof exports)t(exports,require("@merkur/core"));else{var e={exports:{}};t(e.exports,r.Merkur.Core),r.Merkur=r.Merkur||{},r.Merkur.Plugin=r.Merkur.Plugin||{},r.Merkur.Plugin.Error=e.exports}}("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:this,(function(t,e){Object.defineProperty(t,"__esModule",{value:!0}),t.GenericError=t.ERROR_EVENTS=void 0,t.errorPlugin=function(){return{setup:function(r){return s((function*(){return r.error=r.error?r.error:{status:null,message:null},r}))()},create:function(r){return s((function*(){if(d===v){if(!r.$in.component)throw new Error("You must install missing plugin: npm i @merkur/plugin-component");if(!r.$in.eventEmitter)throw new Error("You must install missing plugin: npm i @merkur/plugin-event-emitter")}return(0,e.hookMethod)(r,"info",E),(0,e.hookMethod)(r,"load",O),(0,e.hookMethod)(r,"mount",P),(0,e.hookMethod)(r,"update",_),r}))()}}},t.renderContent=M,t.setErrorInfo=R;var n=["status"];function o(r){return function(r){if(Array.isArray(r))return i(r)}(r)||function(r){if("undefined"!=typeof Symbol&&null!=r[Symbol.iterator]||null!=r["@@iterator"])return Array.from(r)}(r)||function(r,t){if(r){if("string"==typeof r)return i(r,t);var e={}.toString.call(r).slice(8,-1);return"Object"===e&&r.constructor&&(e=r.constructor.name),"Map"===e||"Set"===e?Array.from(r):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?i(r,t):void 0}}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(r,t){(null==t||t>r.length)&&(t=r.length);for(var e=0,n=Array(t);e<t;e++)n[e]=r[e];return n}function u(r,t){var e=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),e.push.apply(e,n)}return e}function a(r,t,e){return(t=l(t))in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}function c(r,t,e,n,o,i,u){try{var a=r[i](u),c=a.value}catch(r){return void e(r)}a.done?t(c):Promise.resolve(c).then(n,o)}function s(r){return function(){var t=this,e=arguments;return new Promise((function(n,o){var i=r.apply(t,e);function u(r){c(i,n,o,u,a,"next",r)}function a(r){c(i,n,o,u,a,"throw",r)}u(void 0)}))}}function f(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,l(n.key),n)}}function l(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,e||"default");if("object"!=r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}function p(t,e,n){return e=h(e),function(t,e){if(e&&("object"==r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(r){if(void 0===r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}(t)}(t,y()?Reflect.construct(e,n||[],h(t).constructor):e.apply(t,n))}function y(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(r){}return(y=function(){return!!r})()}function h(r){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},h(r)}function b(r,t){return b=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,t){return r.__proto__=t,r},b(r,t)}function m(r){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!(this instanceof m))throw new TypeError("Cannot call a class as a function");if(this.constructor===m)throw new TypeError("The ExtensibleError is an abstract class and must be extended before it can be instantiated.");Error.call(this,r),this.name=this.constructor.name,this.message=r,this._nativeError=new Error(r),this._nativeError.name=this.name,this._nativeError.columnNumber&&(this.lineNumber=this._nativeError.lineNumber,this.columnNumber=this._nativeError.columnNumber,this.fileName=this._nativeError.fileName),this._stack=null,this._dropInternalStackFrames=t}m.prototype=Object.create(Error.prototype),m.prototype.constructor=m,Object.defineProperty(m.prototype,"stack",{configurable:!0,enumerable:!1,get:function(){if(this._stack)return this._stack;var r=this._nativeError.stack;if("string"==typeof r){if(this._dropInternalStackFrames){for(var t=r.split("\n"),e=1,n=Object.getPrototypeOf(this);n!==m.prototype;)n=Object.getPrototypeOf(n),e++;t.splice(1,e),this._stack=t.join("\n")}else this._stack=r;return this._stack}}});t.GenericError=function(r){function t(r,e){var o;!function(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),o=p(this,t,[r]);var i=e.status,u=void 0===i?500:i,a=function(r,t){if(null==r)return{};var e,n,o=function(r,t){if(null==r)return{};var e={};for(var n in r)if({}.hasOwnProperty.call(r,n)){if(-1!==t.indexOf(n))continue;e[n]=r[n]}return e}(r,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);for(n=0;n<i.length;n++)e=i[n],-1===t.indexOf(e)&&{}.propertyIsEnumerable.call(r,e)&&(o[e]=r[e])}return o}(e,n);return o.name="Error",o.status=u,o._params=a,o}return function(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),t&&b(r,t)}(t,r),e=t,(o=[{key:"params",get:function(){return this._params}}])&&f(e.prototype,o),i&&f(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,o,i}(m);var v="development",d="undefined"!=typeof process&&process&&process.env?process.env.NODE_ENV:v,g=t.ERROR_EVENTS={ERROR:"@merkur/plugin-error.error"};function O(r,t){return w.apply(this,arguments)}function w(){return w=s((function*(r,t){var e={};if(r.error.status)return e;try{for(var n=arguments.length,o=new Array(n>2?n-2:0),i=2;i<n;i++)o[i-2]=arguments[i];e=yield t.apply(void 0,o)}catch(t){t.status=t.status||500,R(r,t),x(r,t)}return e})),w.apply(this,arguments)}function E(r,t){return j.apply(this,arguments)}function j(){return j=s((function*(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];var i=yield t.apply(void 0,n);return function(r){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?u(Object(e),!0).forEach((function(t){a(r,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(e)):u(Object(e)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(e,t))}))}return r}({error:r.error},i)})),j.apply(this,arguments)}function P(r,t){return k.apply(this,arguments)}function k(){return k=s((function*(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];return M(r,t,n)})),k.apply(this,arguments)}function _(r,t){return S.apply(this,arguments)}function S(){return S=s((function*(r,t){for(var e=arguments.length,n=new Array(e>2?e-2:0),o=2;o<e;o++)n[o-2]=arguments[o];return M(r,t,n)})),S.apply(this,arguments)}function R(r,t){r.error.status=t.status,r.error.message=t.message,r.error.url=t.params&&t.params.url,d===v&&(r.error.stack=t.stack)}function x(r,t){r.emit(g.ERROR,{error:t})}function M(r,t,e){return N.apply(this,arguments)}function N(){return(N=s((function*(r,t,e){if(r.error.status)try{return yield t.apply(void 0,o(e))}catch(r){return""}try{return yield t.apply(void 0,o(e))}catch(n){return n.status=n.status||500,R(r,n),x(r,n),M(r,t,e)}}))).apply(this,arguments)}}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@merkur/plugin-error",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "description": "Merkur plugin for error handling.",
5
5
  "main": "lib/index",
6
6
  "module": "lib/index",
@@ -50,12 +50,12 @@
50
50
  },
51
51
  "homepage": "https://merkur.js.org/",
52
52
  "devDependencies": {
53
- "@merkur/core": "^0.37.0",
54
- "@merkur/plugin-component": "^0.37.0"
53
+ "@merkur/core": "^0.38.0",
54
+ "@merkur/plugin-component": "^0.38.0"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "@merkur/core": "*",
58
58
  "@merkur/plugin-component": "*"
59
59
  },
60
- "gitHead": "af826493e5ed4b37602dd43ce89a59baeeb1bada"
60
+ "gitHead": "a6e379c0cb887898e34465dc3db9231feb68e6a5"
61
61
  }