httpx

Collection of libs: http exceptions, dsn-parser...

MIT License

Downloads
67.2K
Stars
16
Committers
5

Bot releases are hidden (Show)

httpx - @httpx/[email protected]

Published by belgattitude 10 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 10 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 10 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 10 months ago

Patch Changes

  • #832 321957a Thanks @belgattitude! - esbuild updated to 0.19.11 to fix a potential typeScript-specific class transform edge case
httpx - @httpx/[email protected]

Published by belgattitude 10 months ago

Patch Changes

  • #832 321957a Thanks @belgattitude! - esbuild updated to 0.19.11 to fix a potential typeScript-specific class transform edge case
httpx - [email protected]

Published by belgattitude 10 months ago

Patch Changes

  • #832 321957a Thanks @belgattitude! - esbuild updated to 0.19.11 to fix a potential typeScript-specific class transform edge case
httpx - @httpx/[email protected]

Published by belgattitude 10 months ago

Minor Changes

httpx - @httpx/[email protected]

Published by belgattitude 10 months ago

Minor Changes

httpx - @httpx/[email protected]

Published by belgattitude 10 months ago

Minor Changes

  • #826 a2f8352 Thanks @belgattitude! - Improve assertion error messages (now typed as TypeError)

    Assertions errors includes information about received value. They're
    now typed as native TypeError.

    expect(() => assertUuid("123")).toThrow(
      new TypeError("Value is expected to be an uuid, got: string(3)"),
    );
    expect(() => assertUuid(false, undefined, { version: 1 })).toThrow(
      new TypeError("Value is expected to be an uuid v1, got: boolean(false)"),
    );
    expect(() => assertUuidV1(Number.NaN)).toThrow(
      new TypeError("Value is expected to be an uuid v1, got: NaN"),
    );
    expect(() => assertUuidV3(new Error())).toThrow(
      new TypeError("Value is expected to be an uuid v3, got: Error"),
    );
    expect(() => assertUuidV4(new Date())).toThrow(
      new TypeError("Value is expected to be an uuid v4, got: Date"),
    );
    expect(() => assertUuidV5(() => {})).toThrow(
      new TypeError("Value is expected to be an uuid v5, got: function"),
    );
    
httpx - @httpx/[email protected]

Published by belgattitude 10 months ago

Minor Changes

httpx - @httpx/[email protected]

Published by belgattitude 10 months ago

Minor Changes

httpx - @httpx/[email protected]

Published by belgattitude 10 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 10 months ago

Minor Changes

  • #815 77cd15b Thanks @belgattitude! - Deprecate the type HttpStatusCode, use HttpErrorStatusCode instead

    HttpErrorStatusCode is less ambiguous ad HttpStatusCode could be understood
    as HttpStatusCode could represent all http statuses. The type is exported
    but there's very few chances an regular user would be impacted.

  • #815 77cd15b Thanks @belgattitude! - Add new types: HttpErrorStatusCode and HttpErrorStatusCodeOrNumber

    Improves the typescript experience by allowing typescript to suggest assigned
    status codes in createException and HttpException, HttpClientException,
    HttpServerException constructors. Arbitray numbers can still be used.

  • #815 77cd15b Thanks @belgattitude! - Add new typeguards: isErrorWithErrorStatusCode and isObjectWithErrorStatusCode

    Those typeguards can be used in specific circumstances when an originating
    error has a statusCode field which indicates by convention the preferred status
    to send.

    import {
      isErrorWithErrorStatusCode,
      createHttpException,
    } from "@httpx/exception";
    
    try {
      throw new (class extends Error {
        statusCode = 400;
      })();
    } catch (e) {
      if (isErrorWithErrorStatusCode(e)) {
        throw createException(e.statusCode, "Something wrong happened");
      }
    }
    
    const noSuchUser = {
      statusCode: 404,
    } satisfies ObjectWithStatusCode;
    
    class NoSuchItem extends DomainError implements ObjectWithStatusCode {
      statusCode: 404;
    }
    
    if (isObjectWithErrorStatusCode(noSuchUser)) {
      throw createException(e.statusCode, "Nothing");
    }
    
httpx - @httpx/[email protected]

Published by belgattitude 10 months ago

Patch Changes

httpx - [email protected]

Published by belgattitude 11 months ago

prisma-exception

httpx - @httpx/[email protected]

Published by belgattitude 11 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 11 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 11 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 11 months ago

Patch Changes

httpx - @httpx/[email protected]

Published by belgattitude 11 months ago

Patch Changes