@xylabs/error 4.15.0 → 4.15.2

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.
@@ -1,3 +1,3 @@
1
1
  export * from './handleError.ts';
2
- export * from './isError.ts';
2
+ export { isError } from '@xylabs/typeof';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA"}
@@ -1,9 +1,5 @@
1
- // src/isError.ts
2
- var isError = (error) => {
3
- return typeof error.message === "string" && typeof error.name === "string";
4
- };
5
-
6
1
  // src/handleError.ts
2
+ import { isError } from "@xylabs/typeof";
7
3
  var handleError = (error, handler) => {
8
4
  if (isError(error)) {
9
5
  return handler(error);
@@ -18,9 +14,12 @@ var handleErrorAsync = async (error, handler) => {
18
14
  throw error;
19
15
  }
20
16
  };
17
+
18
+ // src/index.ts
19
+ import { isError as isError2 } from "@xylabs/typeof";
21
20
  export {
22
21
  handleError,
23
22
  handleErrorAsync,
24
- isError
23
+ isError2 as isError
25
24
  };
26
25
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/isError.ts","../../src/handleError.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isError = (error: any): error is Error => {\n return typeof error.message === 'string' && typeof error.name === 'string'\n}\n","import { isError } from './isError.ts'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const handleError = <T>(error: any, handler: (error: Error) => T) => {\n if (isError(error)) {\n return handler(error)\n } else {\n throw error\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const handleErrorAsync = async <T>(error: any, handler: (error: Error) => Promise<T>) => {\n if (isError(error)) {\n return await handler(error)\n } else {\n throw error\n }\n}\n"],"mappings":";AACO,IAAM,UAAU,CAAC,UAA+B;AACrD,SAAO,OAAO,MAAM,YAAY,YAAY,OAAO,MAAM,SAAS;AACpE;;;ACAO,IAAM,cAAc,CAAI,OAAY,YAAiC;AAC1E,MAAI,QAAQ,KAAK,GAAG;AAClB,WAAO,QAAQ,KAAK;AAAA,EACtB,OAAO;AACL,UAAM;AAAA,EACR;AACF;AAGO,IAAM,mBAAmB,OAAU,OAAY,YAA0C;AAC9F,MAAI,QAAQ,KAAK,GAAG;AAClB,WAAO,MAAM,QAAQ,KAAK;AAAA,EAC5B,OAAO;AACL,UAAM;AAAA,EACR;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/handleError.ts","../../src/index.ts"],"sourcesContent":["import { isError } from '@xylabs/typeof'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const handleError = <T>(error: any, handler: (error: Error) => T) => {\n if (isError(error)) {\n return handler(error)\n } else {\n throw error\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const handleErrorAsync = async <T>(error: any, handler: (error: Error) => Promise<T>) => {\n if (isError(error)) {\n return await handler(error)\n } else {\n throw error\n }\n}\n","export * from './handleError.ts'\nexport { isError } from '@xylabs/typeof'\n"],"mappings":";AAAA,SAAS,eAAe;AAGjB,IAAM,cAAc,CAAI,OAAY,YAAiC;AAC1E,MAAI,QAAQ,KAAK,GAAG;AAClB,WAAO,QAAQ,KAAK;AAAA,EACtB,OAAO;AACL,UAAM;AAAA,EACR;AACF;AAGO,IAAM,mBAAmB,OAAU,OAAY,YAA0C;AAC9F,MAAI,QAAQ,KAAK,GAAG;AAClB,WAAO,MAAM,QAAQ,KAAK;AAAA,EAC5B,OAAO;AACL,UAAM;AAAA,EACR;AACF;;;ACjBA,SAAS,WAAAA,gBAAe;","names":["isError"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/error",
3
- "version": "4.15.0",
3
+ "version": "4.15.2",
4
4
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
5
  "keywords": [
6
6
  "error",
@@ -41,6 +41,9 @@
41
41
  "dist",
42
42
  "src"
43
43
  ],
44
+ "dependencies": {
45
+ "@xylabs/typeof": "^4.15.2"
46
+ },
44
47
  "devDependencies": {
45
48
  "@xylabs/ts-scripts-yarn3": "^7.0.1",
46
49
  "@xylabs/tsconfig": "^7.0.1",
@@ -1,4 +1,4 @@
1
- import { isError } from './isError.ts'
1
+ import { isError } from '@xylabs/typeof'
2
2
 
3
3
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
4
  export const handleError = <T>(error: any, handler: (error: Error) => T) => {
package/src/index.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export * from './handleError.ts'
2
- export * from './isError.ts'
2
+ export { isError } from '@xylabs/typeof'
@@ -1,2 +0,0 @@
1
- export declare const isError: (error: any) => error is Error;
2
- //# sourceMappingURL=isError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isError.d.ts","sourceRoot":"","sources":["../../src/isError.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI,KAE7C,CAAA"}
package/src/isError.ts DELETED
@@ -1,4 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
- export const isError = (error: any): error is Error => {
3
- return typeof error.message === 'string' && typeof error.name === 'string'
4
- }