Skip to content

Commit

Permalink
fix: correct mistaken "thunk" comment (#1234)
Browse files Browse the repository at this point in the history
  • Loading branch information
erights authored Jul 22, 2022
1 parent 8f87da4 commit f8b49d4
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/ses-ava/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@
/**
* @callback LogCallError
*
* Calls `thunk()` passing back approximately its outcome, but first
* Calls `func(...args)` passing back approximately its outcome, but first
* logging any erroneous outcome to the `logger`, which defaults to
* `console.log`.
*
* If thunk returns a non-promise, silently return it.
* If thunk throws, log what was thrown and then rethrow it.
* If thunk returns a promise, immediately return a new unresolved promise.
* If the first promise fulfills, silently fulfill the returned promise even if
* the fulfillment was an error.
* If the first promise rejects, log the rejection reason and then reject the
* returned promise with the same reason.
* * If `func(...args)` returns a non-promise, silently return it.
* * If `func(...args)` throws, log what was thrown and then rethrow it.
* * If `func(...args)` returns a promise, immediately return a new
* unresolved promise.
* * If the first promise fulfills, silently fulfill the returned promise
* even if the fulfillment was an error.
* * If the first promise rejects, log the rejection reason and then
* reject the returned promise with the same reason.
*
* The delayed rejection of the returned promise is an observable difference
* from directly calling `thunk()` but will be equivalent enough for most
* from directly calling `func(...args)` but will be equivalent enough for most
* purposes.
*
* TODO This function is useful independent of ava, so consider moving it
Expand Down

0 comments on commit f8b49d4

Please sign in to comment.