MCPcopy Index your code
hub / github.com/Effect-TS/effect / throws

Function throws

packages/effect/test/util.ts:82–95  ·  view source on GitHub ↗
(thunk: () => void, error?: Error | ((u: unknown) => undefined), ..._: Array<never>)

Source from the content-addressed store, hash-verified

80}
81
82export function throws(thunk: () => void, error?: Error | ((u: unknown) => undefined), ..._: Array<never>) {
83 try {
84 thunk()
85 fail("Expected to throw an error")
86 } catch (e) {
87 if (error !== undefined) {
88 if (Predicate.isFunction(error)) {
89 error(e)
90 } else {
91 deepStrictEqual(e, error)
92 }
93 }
94 }
95}
96
97export async function throwsAsync(
98 thunk: () => Promise<void>,

Callers 1

parseErrorFunction · 0.50

Calls 3

failFunction · 0.70
deepStrictEqualFunction · 0.70
errorFunction · 0.50

Tested by

no test coverage detected