Collection of libs: http exceptions, dsn-parser...
MIT License
Bot releases are visible (Hide)
Published by belgattitude 10 months ago
b14449f
Thanks @belgattitude! - Improve documentationPublished by belgattitude 10 months ago
#832 321957a
Thanks @belgattitude! - esbuild updated to 0.19.11 to fix a potential typeScript-specific class transform edge case
Updated dependencies [9d4dd98
, 321957a
]:
Published by belgattitude 10 months ago
#834 9d4dd98
Thanks @belgattitude! - Add missing doc for nested errors
#832 321957a
Thanks @belgattitude! - esbuild updated to 0.19.11 to fix a potential typeScript-specific class transform edge case
Published by belgattitude 10 months ago
321957a
Thanks @belgattitude! - esbuild updated to 0.19.11 to fix a potential typeScript-specific class transform edge casePublished by belgattitude 10 months ago
321957a
Thanks @belgattitude! - esbuild updated to 0.19.11 to fix a potential typeScript-specific class transform edge casePublished by belgattitude 10 months ago
321957a
Thanks @belgattitude! - esbuild updated to 0.19.11 to fix a potential typeScript-specific class transform edge casePublished by belgattitude 10 months ago
#829 b3ff1b9
Thanks @belgattitude! - Add assertNumberSafeInt, isNumberSafeInt and NumberSafeInt type
#829 b3ff1b9
Thanks @belgattitude! - Add isArrayNotEmpty, assertArrayNotEmpty and ArrayNotEmpty type
#829 b3ff1b9
Thanks @belgattitude! - Add isStrParsableSafeInt, assertStrParsableSafeInt and type StrParsableSafeInt
Published by belgattitude 10 months ago
18aad8b
Thanks @belgattitude! - Add assertNever and assertNeverNoThrowPublished by belgattitude 10 months ago
#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"),
);
Published by belgattitude 10 months ago
24ccdee
Thanks @belgattitude! - Reduce bundle size for esmPublished by belgattitude 10 months ago
b32e907
Thanks @belgattitude! - Initial @httpx/assert packagePublished by belgattitude 10 months ago
77cd15b
, 77cd15b
, 77cd15b
]:
Published by belgattitude 10 months ago
#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");
}
Published by belgattitude 10 months ago
ca13c91
Thanks @belgattitude! - Fix isPlainObject in edge-runtimePublished by belgattitude 11 months ago
Published by belgattitude 11 months ago
b004243
]:
Published by belgattitude 11 months ago
b004243
Thanks @belgattitude! - Add toc in readmePublished by belgattitude 11 months ago
39ec1d5
Thanks @belgattitude! - Fix README doc linksPublished by belgattitude 11 months ago
39ec1d5
]:
Published by belgattitude 11 months ago
4e2b795
]: