Hacker News new | ask | show | jobs
by akoboldfrying 427 days ago
Pretty sure this line: https://meowbark.dev/Better-error-handling#:~:text=return%20...

will immediately throw if b == 0, because

    a / b
is evaluated immediately, so execution never makes it into fromThrowable(). Does it need to be

    () => a / b
instead?

Similarly, withRetry()'s argument needs to have type "() => ResultAsync<T, ApiError>" -- at present, it is passed a result, and if that result is a RateLimit error, it will just return the same error again 1s later.