Skip to content

Commit

Permalink
extract message from error
Browse files Browse the repository at this point in the history
  • Loading branch information
vladbasin committed Jan 13, 2024
1 parent ce0c44a commit 06e19b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ export class Result<T> {
}

private getErrorString(error: any) {
return error instanceof Error ? error.message : `${error}`;
return error instanceof Error || error?.message ? error.message : `${error}`;
}

private execute<K, V>(action: (input: K) => V | Promise<V> | Result<V>, argument: K): Promise<V> {
Expand Down

0 comments on commit 06e19b4

Please sign in to comment.