Skip to content

Commit

Permalink
Use getErrorMessage()
Browse files Browse the repository at this point in the history
  • Loading branch information
aedart committed Feb 21, 2024
1 parent ca347a0 commit 7f786b6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/support/src/arrays/merge.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ArrayMergeError } from "./exceptions";
import { getErrorMessage } from "@aedart/support/exceptions";

/**
* Merge two or more arrays
Expand All @@ -25,9 +26,7 @@ export function merge(

return structuredClone([].concat(...sources));
} catch (e) {
const reason: string = (typeof e == 'object' && Reflect.has(e, 'message'))
? e.message
: 'unknown reason';
const reason = getErrorMessage(e);

throw new ArrayMergeError('Unable to merge arrays: ' + reason, {
cause: {
Expand Down

0 comments on commit 7f786b6

Please sign in to comment.