Skip to content

Commit

Permalink
fix(utils): partially restore error suppression
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Jan 9, 2024
1 parent 1cca5d8 commit 338588b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/utils/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ export const applyLabelingError = (func, args, label = undefined) => {
throwLabeled(err, label);
}
if (isPromise(result)) {
// Cannot be at-ts-expect-error because there is no type error locally.
// Rather, a type error only as imported into exo.
// @ts-ignore If result is a rejected promise, this will
// return a promise with a different rejection reason. But this
// confuses TypeScript because it types that case as `Promise<never>`
// which is cool for a promise that will never fulfll.
// But TypeScript doesn't understand that this will only happen
// when `result` was a rejected promise. In only this case `R`
// should already allow `Promise<never>` as a subtype.
return E.when(result, undefined, reason => throwLabeled(reason, label));
} else {
return result;
Expand Down

0 comments on commit 338588b

Please sign in to comment.