So, withKaplayContext is used in a vitest unit test.
So, I want to avoid exn all together really, it is not the relevant thing to have here.
// https://v4000.kaplayjs.com/docs/api/ctx/onError/
onError(action: (err: Error) => void): KEventController
uses Error
And for a rejecting promise in a vitest test, it might come from toHaveBeenCalled
which is all an actual Error object.
Are we not missing something in the StdLib like:
let tryConvert: (exn) => JsError.t = %raw`function (exn) { return Error.isError(exn) ? exn : undefined;`