2 pointsby pbpeterson9 hours ago1 comment
  • pbpeterson9 hours ago
    I built a thin wrapper over the Fetch API that returns errors as values instead of throwing. Inspired by Go's result, err pattern.

    No try/catch. TypeScript narrows the error type so you know exactly which HTTP errors to handle at compile time. 40 typed error classes for all standard status codes, plus a separate NetworkError for connection failures.

    Would love feedback on the API design.