@fozy-labs/rx-toolkit 0.4.8 → 0.4.9

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,7 +1,7 @@
1
1
  import type { DevtoolsLike } from "../../common/devtools";
2
2
  type Update = Partial<{
3
3
  DEVTOOLS: DevtoolsLike | null;
4
- onError: (error: unknown) => void;
4
+ onQueryError: (error: unknown) => void;
5
5
  }>;
6
6
  export declare class DefaultOptions {
7
7
  static update(part: Update): void;
@@ -3,7 +3,7 @@ export class DefaultOptions {
3
3
  static update(part) {
4
4
  if (part.DEVTOOLS !== undefined)
5
5
  SharedOptions.DEVTOOLS = part.DEVTOOLS;
6
- if (part.onError !== undefined)
7
- SharedOptions.onError = part.onError;
6
+ if (part.onQueryError !== undefined)
7
+ SharedOptions.onQueryError = part.onQueryError;
8
8
  }
9
9
  }
@@ -1,5 +1,5 @@
1
1
  import { DevtoolsLike } from "../../common/devtools";
2
2
  export declare class SharedOptions {
3
3
  static DEVTOOLS: DevtoolsLike | null;
4
- static onError: ((error: unknown) => void) | null;
4
+ static onQueryError: ((error: unknown) => void) | null;
5
5
  }
@@ -1,4 +1,4 @@
1
1
  export class SharedOptions {
2
2
  static DEVTOOLS = null;
3
- static onError = null;
3
+ static onQueryError = null;
4
4
  }
@@ -31,14 +31,11 @@ export class QueriesLifetimeHooks {
31
31
  });
32
32
  }
33
33
  }
34
- if (SharedOptions.onError) {
35
- this.onQueryStartedListeners.push(async (args, { $queryFulfilled }) => {
36
- try {
37
- await $queryFulfilled;
38
- }
39
- catch (error) {
40
- SharedOptions.onError(error);
41
- }
34
+ if (SharedOptions.onQueryError) {
35
+ this.onQueryStartedListeners.push(async (_, { $queryFulfilled }) => {
36
+ const result = await $queryFulfilled;
37
+ if (result.isError)
38
+ SharedOptions.onQueryError(result.error);
42
39
  });
43
40
  }
44
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fozy-labs/rx-toolkit",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "type": "module",