@lskjs/err
Advanced tools
Comparing version 3.9.0 to 3.11.0
@@ -1,3 +0,3 @@ | ||
"use strict";var g=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var o=(t,e)=>g(t,"name",{value:e,configurable:!0});var k=(t,e)=>{for(var s in e)g(t,s,{get:e[s],enumerable:!0})},N=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of y(e))!P.call(t,n)&&n!==s&&g(t,n,{get:()=>e[n],enumerable:!(r=_(e,n))||r.enumerable});return t};var j=t=>N(g({},"__esModule",{value:!0}),t);var b={};k(b,{Err:()=>i,default:()=>J,isErr:()=>O});module.exports=j(b);var m=o((t,e)=>{typeof e!="string"&&Object.keys(e).forEach(s=>{let r=e[s];typeof r!="function"&&(t[s]=r)})},"copyProps");var c=require("@lskjs/algos");var S=o(t=>t&&t.__err,"isLskError"),w=o(t=>(0,c.pick)(t,Object.getOwnPropertyNames(t)),"getLskErrorProps"),l=o((t,e=["name","message","stack","text"])=>(0,c.isPlainObject)(t)?t:t instanceof Error?S(t)?w(t):(0,c.pick)(t,e):{},"errProps");var h=o((...t)=>{let[e,s]=t,r={};return typeof e=="string"&&(r.code=e,typeof s=="string"&&(r.message=s)),t.forEach(n=>{r={...r,...l(n)}}),r},"errMerge");var p=require("@lskjs/algos");var M=o(t=>Array.from(new Set(t)),"uniq"),a="err_unknown",f=o((t,e=a)=>{if(typeof t=="string")return t;let s=t&&t.name!=="Error"?t.name:null;return t&&(t.message||t.text||t.code||s)||e},"getMessage"),x=o((t,e=a)=>{let s=[t.code,f(t),t.text,t.stack];return t&&M(s.filter(Boolean)).join(` | ||
`)||e||a},"getText"),u=o((t,e=a)=>t&&(t.code||t.text||t.message)||e,"getCode"),d=o((t,e=!1)=>{if(typeof t=="string")return{code:t,message:t};let s={...t&&t.__raw||{}};return e?s={...s,...(0,p.pick)(t,["name","code","message","text","data"])}:s={...s,...(0,p.omit)((0,p.pick)(t,Object.getOwnPropertyNames(t)),["__err"])},s},"getJSON"),E=o(t=>t instanceof Error,"isError");var O=o(t=>t instanceof i,"isErr"),i=class extends Error{code;__err=!0;constructor(...e){let s=h(...e);super(f(s)),this.name=this.constructor.name,Object.keys(s).forEach(r=>{let n=s[r];r==="message"?this.message!==n&&n&&(this.__parentErrorMessage=n):r==="stack"?this.__parentErrorStack=n:this[r]=n}),this.code||(this.code=u(s))}static getMessage(e,s=a){return f(e,s)}static getText(e,s=a){return x(e,s)}static getCode(e,s=a){return u(e,s)}static getJSON(e,s=!1){return d(e,s)}static isError(e){return E(e)}static isErr(e){return O(e)}static copyProps(e,s){m(e,s)}copyProps(e){m(this,e)}getText(){return x(this)}getJSON(e=!1){return d(this,e)}getMessage(){return f(this)}getCode(){return u(this)}toJSON(){return this.getJSON(!0)}};o(i,"Err");var J=i;0&&(module.exports={Err,isErr}); | ||
"use strict";var g=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var o=(t,e)=>g(t,"name",{value:e,configurable:!0});var k=(t,e)=>{for(var s in e)g(t,s,{get:e[s],enumerable:!0})},N=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of y(e))!P.call(t,n)&&n!==s&&g(t,n,{get:()=>e[n],enumerable:!(r=_(e,n))||r.enumerable});return t};var j=t=>N(g({},"__esModule",{value:!0}),t);var b={};k(b,{Err:()=>f,default:()=>J,isErr:()=>O});module.exports=j(b);var m=o((t,e)=>{typeof e!="string"&&Object.keys(e).forEach(s=>{let r=e[s];typeof r!="function"&&(t[s]=r)})},"copyProps");var i=require("@lskjs/algos");var S=o(t=>t&&t.__err,"isLskError"),w=o(t=>(0,i.pick)(t,Object.getOwnPropertyNames(t)),"getLskErrorProps"),l=o((t,e=["name","message","stack","text"])=>(0,i.isPlainObject)(t)?t:t instanceof Error?S(t)?w(t):(0,i.pick)(t,e):{},"errProps");var h=o((...t)=>{let[e,s]=t,r={};return typeof e=="string"&&(r.code=e,typeof s=="string"&&(r.message=s)),t.forEach(n=>{r={...r,...l(n)}}),r},"errMerge");var c=require("@lskjs/algos");var M=o(t=>Array.from(new Set(t)),"uniq"),a="err_unknown",p=o((t,e=a)=>{if(typeof t=="string")return t;let s=t&&t.name!=="Error"?t.name:null;return t&&(t.message||t.text||t.code||s)||e},"getMessage"),x=o((t,e=a)=>{let s=[t.code,p(t),t.text,t.stack];return t&&M(s.filter(Boolean)).join(` | ||
`)||e||a},"getText"),u=o((t,e=a)=>t&&(t.code||t.text||t.message)||e,"getCode"),d=o((t,e=!1)=>{if(typeof t=="string")return{code:t,message:t};let s={...t&&t.__raw||{}};return e?s={...s,...(0,c.pick)(t,["name","code","message","text","data"])}:s={...s,...(0,c.omit)((0,c.pick)(t,Object.getOwnPropertyNames(t)),["__err"])},s},"getJSON"),E=o(t=>t instanceof Error,"isError");var O=o(t=>t instanceof f,"isErr"),f=class extends Error{static{o(this,"Err")}code;__err=!0;constructor(...e){let s=h(...e);super(p(s)),this.name=this.constructor.name,Object.keys(s).forEach(r=>{let n=s[r];r==="message"?this.message!==n&&n&&(this.__parentErrorMessage=n):r==="stack"?this.__parentErrorStack=n:this[r]=n}),this.code||(this.code=u(s))}static getMessage(e,s=a){return p(e,s)}static getText(e,s=a){return x(e,s)}static getCode(e,s=a){return u(e,s)}static getJSON(e,s=!1){return d(e,s)}static isError(e){return E(e)}static isErr(e){return O(e)}static copyProps(e,s){m(e,s)}copyProps(e){m(this,e)}getText(){return x(this)}getJSON(e=!1){return d(this,e)}getMessage(){return p(this)}getCode(){return u(this)}toJSON(){return this.getJSON(!0)}},J=f;0&&(module.exports={Err,isErr}); | ||
//# sourceMappingURL=Err.js.map |
@@ -1,7 +0,7 @@ | ||
import * as _lskjs_algos_lib_types from '@lskjs/algos/lib/types'; | ||
import { ObjectLike } from '@lskjs/algos/types'; | ||
declare const isLskError: (err: any) => any; | ||
declare const getLskErrorProps: (err: any) => _lskjs_algos_lib_types.ObjectLike<unknown>; | ||
declare const errProps: (err: any, fields?: string[]) => Record<string, unknown>; | ||
declare const getLskErrorProps: (err: any) => ObjectLike<unknown>; | ||
declare const errProps: (err: any, fields?: string[]) => ObjectLike<unknown>; | ||
export { errProps as default, errProps, getLskErrorProps, isLskError }; |
@@ -6,2 +6,2 @@ export { default as Err, default, isErr } from './Err.js'; | ||
export { IErr } from './types.js'; | ||
import '@lskjs/algos/lib/types'; | ||
import '@lskjs/algos/types'; |
@@ -1,3 +0,3 @@ | ||
"use strict";var m=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var r=(t,e)=>m(t,"name",{value:e,configurable:!0});var S=(t,e)=>{for(var o in e)m(t,o,{get:e[o],enumerable:!0})},w=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of N(e))!j.call(t,n)&&n!==o&&m(t,n,{get:()=>e[n],enumerable:!(s=k(e,n))||s.enumerable});return t};var M=t=>w(m({},"__esModule",{value:!0}),t);var b={};S(b,{Err:()=>c,default:()=>P,errMerge:()=>h,errProps:()=>l,errUnknown:()=>a,getCode:()=>g,getJSON:()=>x,getLskErrorProps:()=>_,getMessage:()=>i,getText:()=>u,isErr:()=>y,isError:()=>E,isLskError:()=>O});module.exports=M(b);var d=r((t,e)=>{typeof e!="string"&&Object.keys(e).forEach(o=>{let s=e[o];typeof s!="function"&&(t[o]=s)})},"copyProps");var p=require("@lskjs/algos");var O=r(t=>t&&t.__err,"isLskError"),_=r(t=>(0,p.pick)(t,Object.getOwnPropertyNames(t)),"getLskErrorProps"),l=r((t,e=["name","message","stack","text"])=>(0,p.isPlainObject)(t)?t:t instanceof Error?O(t)?_(t):(0,p.pick)(t,e):{},"errProps");var h=r((...t)=>{let[e,o]=t,s={};return typeof e=="string"&&(s.code=e,typeof o=="string"&&(s.message=o)),t.forEach(n=>{s={...s,...l(n)}}),s},"errMerge");var f=require("@lskjs/algos");var J=r(t=>Array.from(new Set(t)),"uniq"),a="err_unknown",i=r((t,e=a)=>{if(typeof t=="string")return t;let o=t&&t.name!=="Error"?t.name:null;return t&&(t.message||t.text||t.code||o)||e},"getMessage"),u=r((t,e=a)=>{let o=[t.code,i(t),t.text,t.stack];return t&&J(o.filter(Boolean)).join(` | ||
`)||e||a},"getText"),g=r((t,e=a)=>t&&(t.code||t.text||t.message)||e,"getCode"),x=r((t,e=!1)=>{if(typeof t=="string")return{code:t,message:t};let o={...t&&t.__raw||{}};return e?o={...o,...(0,f.pick)(t,["name","code","message","text","data"])}:o={...o,...(0,f.omit)((0,f.pick)(t,Object.getOwnPropertyNames(t)),["__err"])},o},"getJSON"),E=r(t=>t instanceof Error,"isError");var y=r(t=>t instanceof c,"isErr"),c=class extends Error{code;__err=!0;constructor(...e){let o=h(...e);super(i(o)),this.name=this.constructor.name,Object.keys(o).forEach(s=>{let n=o[s];s==="message"?this.message!==n&&n&&(this.__parentErrorMessage=n):s==="stack"?this.__parentErrorStack=n:this[s]=n}),this.code||(this.code=g(o))}static getMessage(e,o=a){return i(e,o)}static getText(e,o=a){return u(e,o)}static getCode(e,o=a){return g(e,o)}static getJSON(e,o=!1){return x(e,o)}static isError(e){return E(e)}static isErr(e){return y(e)}static copyProps(e,o){d(e,o)}copyProps(e){d(this,e)}getText(){return u(this)}getJSON(e=!1){return x(this,e)}getMessage(){return i(this)}getCode(){return g(this)}toJSON(){return this.getJSON(!0)}};r(c,"Err");var P=c;0&&(module.exports={Err,errMerge,errProps,errUnknown,getCode,getJSON,getLskErrorProps,getMessage,getText,isErr,isError,isLskError}); | ||
"use strict";var m=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var r=(t,e)=>m(t,"name",{value:e,configurable:!0});var S=(t,e)=>{for(var o in e)m(t,o,{get:e[o],enumerable:!0})},w=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of N(e))!j.call(t,n)&&n!==o&&m(t,n,{get:()=>e[n],enumerable:!(s=k(e,n))||s.enumerable});return t};var M=t=>w(m({},"__esModule",{value:!0}),t);var b={};S(b,{Err:()=>g,default:()=>P,errMerge:()=>h,errProps:()=>l,errUnknown:()=>a,getCode:()=>f,getJSON:()=>x,getLskErrorProps:()=>_,getMessage:()=>i,getText:()=>u,isErr:()=>y,isError:()=>E,isLskError:()=>O});module.exports=M(b);var d=r((t,e)=>{typeof e!="string"&&Object.keys(e).forEach(o=>{let s=e[o];typeof s!="function"&&(t[o]=s)})},"copyProps");var c=require("@lskjs/algos");var O=r(t=>t&&t.__err,"isLskError"),_=r(t=>(0,c.pick)(t,Object.getOwnPropertyNames(t)),"getLskErrorProps"),l=r((t,e=["name","message","stack","text"])=>(0,c.isPlainObject)(t)?t:t instanceof Error?O(t)?_(t):(0,c.pick)(t,e):{},"errProps");var h=r((...t)=>{let[e,o]=t,s={};return typeof e=="string"&&(s.code=e,typeof o=="string"&&(s.message=o)),t.forEach(n=>{s={...s,...l(n)}}),s},"errMerge");var p=require("@lskjs/algos");var J=r(t=>Array.from(new Set(t)),"uniq"),a="err_unknown",i=r((t,e=a)=>{if(typeof t=="string")return t;let o=t&&t.name!=="Error"?t.name:null;return t&&(t.message||t.text||t.code||o)||e},"getMessage"),u=r((t,e=a)=>{let o=[t.code,i(t),t.text,t.stack];return t&&J(o.filter(Boolean)).join(` | ||
`)||e||a},"getText"),f=r((t,e=a)=>t&&(t.code||t.text||t.message)||e,"getCode"),x=r((t,e=!1)=>{if(typeof t=="string")return{code:t,message:t};let o={...t&&t.__raw||{}};return e?o={...o,...(0,p.pick)(t,["name","code","message","text","data"])}:o={...o,...(0,p.omit)((0,p.pick)(t,Object.getOwnPropertyNames(t)),["__err"])},o},"getJSON"),E=r(t=>t instanceof Error,"isError");var y=r(t=>t instanceof g,"isErr"),g=class extends Error{static{r(this,"Err")}code;__err=!0;constructor(...e){let o=h(...e);super(i(o)),this.name=this.constructor.name,Object.keys(o).forEach(s=>{let n=o[s];s==="message"?this.message!==n&&n&&(this.__parentErrorMessage=n):s==="stack"?this.__parentErrorStack=n:this[s]=n}),this.code||(this.code=f(o))}static getMessage(e,o=a){return i(e,o)}static getText(e,o=a){return u(e,o)}static getCode(e,o=a){return f(e,o)}static getJSON(e,o=!1){return x(e,o)}static isError(e){return E(e)}static isErr(e){return y(e)}static copyProps(e,o){d(e,o)}copyProps(e){d(this,e)}getText(){return u(this)}getJSON(e=!1){return x(this,e)}getMessage(){return i(this)}getCode(){return f(this)}toJSON(){return this.getJSON(!0)}},P=g;0&&(module.exports={Err,errMerge,errProps,errUnknown,getCode,getJSON,getLskErrorProps,getMessage,getText,isErr,isError,isLskError}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@lskjs/err", | ||
"version": "3.9.0", | ||
"version": "3.11.0", | ||
"description": "LSK.js – err – Error class and utils for custom code and message extracting", | ||
"author": "Igor Suvorov <hi@isuvorov.com> (https://github.com/isuvorov)", | ||
"dependencies": { | ||
"@lskjs/algos": "^3.9.0" | ||
"@lskjs/algos": "^3.11.0" | ||
}, | ||
@@ -41,3 +41,3 @@ "files": [ | ||
], | ||
"gitHead": "22a143f05ea47becc32b36d58e9445d1fa6099d4" | ||
"gitHead": "150463ce96bcc80a2187339a44762e7807cbf41c" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
155284
44
Updated@lskjs/algos@^3.11.0