Skip to content

Commit

Permalink
Merge pull request #17 from zarbanio/chore/add-vault-example
Browse files Browse the repository at this point in the history
Chore(handler): add error handler
  • Loading branch information
arashalaei authored Dec 20, 2024
2 parents 8bd7e33 + b757df7 commit f487d64
Show file tree
Hide file tree
Showing 34 changed files with 439 additions and 32 deletions.
1 change: 1 addition & 0 deletions dist/esm/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * as Service from "./service";
export * as Wallet from "./wallet";
export * as ZarbanUtils from "./utils";
//# sourceMappingURL=index.d.ts.map
2 changes: 1 addition & 1 deletion dist/esm/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/esm/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/esm/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions dist/esm/utils/errorHandler.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ModelError as WalletModelError, UserError as WalletUserError } from "../wallet";
import { ModelError as ServiceModelError, UserError as ServiceUserError } from "../service";
import type { AxiosResponse } from "axios";
type AsyncFn<T> = (...args: any[]) => Promise<T>;
type SuccessCallback<T> = (result: T) => void;
export declare function isOfType<T>(obj: any, keys: (keyof T)[]): obj is T;
type ErrorTypes = Error | ServiceModelError | WalletModelError | ServiceUserError | WalletUserError;
export declare function withErrorHandler<T>(sdkName: "Service" | "Wallet", fn: AsyncFn<AxiosResponse<T>>, onSuccess?: SuccessCallback<AxiosResponse<T>>): (...args: Parameters<typeof fn>) => Promise<[T | null, ErrorTypes | null]>;
export {};
//# sourceMappingURL=errorHandler.d.ts.map
1 change: 1 addition & 0 deletions dist/esm/utils/errorHandler.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

100 changes: 100 additions & 0 deletions dist/esm/utils/errorHandler.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/esm/utils/errorHandler.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions dist/esm/utils/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./errorHandler";
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions dist/esm/utils/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions dist/esm/utils/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/esm/utils/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * as Service from "./service";
export * as Wallet from "./wallet";
export * as ZarbanUtils from "./utils";
//# sourceMappingURL=index.d.ts.map
2 changes: 1 addition & 1 deletion dist/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions dist/utils/errorHandler.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { ModelError as WalletModelError, UserError as WalletUserError } from "../wallet";
import { ModelError as ServiceModelError, UserError as ServiceUserError } from "../service";
import type { AxiosResponse } from "axios";
type AsyncFn<T> = (...args: any[]) => Promise<T>;
type SuccessCallback<T> = (result: T) => void;
export declare function isOfType<T>(obj: any, keys: (keyof T)[]): obj is T;
type ErrorTypes = Error | ServiceModelError | WalletModelError | ServiceUserError | WalletUserError;
export declare function withErrorHandler<T>(sdkName: "Service" | "Wallet", fn: AsyncFn<AxiosResponse<T>>, onSuccess?: SuccessCallback<AxiosResponse<T>>): (...args: Parameters<typeof fn>) => Promise<[T | null, ErrorTypes | null]>;
export {};
//# sourceMappingURL=errorHandler.d.ts.map
1 change: 1 addition & 0 deletions dist/utils/errorHandler.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 104 additions & 0 deletions dist/utils/errorHandler.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f487d64

Please sign in to comment.