Generic helper that wraps any assertion function to add context to error messages.
(optionName: string, assertionFn: () => void)
| 884 | Generic helper that wraps any assertion function to add context to error messages. |
| 885 | */ |
| 886 | function wrapAssertionWithContext(optionName: string, assertionFn: () => void): void { |
| 887 | try { |
| 888 | assertionFn(); |
| 889 | } catch (error) { |
| 890 | if (error instanceof Error) { |
| 891 | error.message = `Option '${optionName}': ${error.message}`; |
| 892 | } |
| 893 | |
| 894 | throw error; |
| 895 | } |
| 896 | } |
| 897 | |
| 898 | /** |
| 899 | Helper function that wraps assert.any() to provide better error messages. |
no outgoing calls
no test coverage detected
searching dependent graphs…