From ede57e16eb547d6790f6629a5fdc6886fbd81ad6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 21 Sep 2022 18:04:48 +0000 Subject: [PATCH] Version Packages --- .changeset/friendly-ducks-fry.md | 43 ---------------------------- examples/nextjs-app/CHANGELOG.md | 7 +++++ examples/nextjs-app/package.json | 2 +- packages/http-exception/CHANGELOG.md | 43 ++++++++++++++++++++++++++++ packages/http-exception/package.json | 2 +- 5 files changed, 52 insertions(+), 45 deletions(-) delete mode 100644 .changeset/friendly-ducks-fry.md diff --git a/.changeset/friendly-ducks-fry.md b/.changeset/friendly-ducks-fry.md deleted file mode 100644 index 306862b..0000000 --- a/.changeset/friendly-ducks-fry.md +++ /dev/null @@ -1,43 +0,0 @@ ---- -'@belgattitude/http-exception': minor ---- - -Add HttpException json serializer. - -Two new methods `fromJson` and `toJson` exported from `@belgattitude/http-exception/serializer`. - - - -HttpException can be serialized to json and vice-versa. It can be useful in ssr frameworks such as -[nextjs](https://nextjs.org/) whenever a server error should be shared within the browser context (see also -the excellent [superjson](https://github.com/blitz-js/superjson#recipes)). - -Serialization supports the [Error.cause](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause) -but totally ignores it the runtime (node or browser) does not support it (or without polyfills). - -Additionally, you can pass any native errors (`Error`, `EvalError`, `RangeError`, `ReferenceError`, `SyntaxError`, `TypeError`, `URIError`) -as well as a custom one (the later will be transformed to the base type Error). That was necessary to support the cause param. - - -| Method | -|-----------------------------------------------------------------------| -| **toJson**(HttpException | NativeError | Error): string | -| **fromJson**(string): HttpException | NativeError | Error | - -```typescript -import { HttpForbidden, HttpUnavailableForLegalReasons } from "@belgattitude/http-exception"; -import { fromJson, toJson } from '@belgattitude/http-exception/serializer'; - -const e = new HttpForbidden({ - url: 'https://www.cool.me' - /* - cause: new HttpUnavailableForLegalReasons({ - cause: new Error('example with cause') - }), - */ -}) - -const json = toJson(e); -const exception = fromJson(json); // e === exception -``` - diff --git a/examples/nextjs-app/CHANGELOG.md b/examples/nextjs-app/CHANGELOG.md index 2e46173..2769aa3 100644 --- a/examples/nextjs-app/CHANGELOG.md +++ b/examples/nextjs-app/CHANGELOG.md @@ -1,5 +1,12 @@ # @examples/nextjs-app +## 0.1.13 + +### Patch Changes + +- Updated dependencies [[`67be0fb`](https://github.com/belgattitude/http-exception/commit/67be0fbbb1acafa2c12a8c5a45b30f8b79ad3c4c)]: + - @belgattitude/http-exception@1.1.0 + ## 0.1.12 ### Patch Changes diff --git a/examples/nextjs-app/package.json b/examples/nextjs-app/package.json index 42fbc48..247f37a 100644 --- a/examples/nextjs-app/package.json +++ b/examples/nextjs-app/package.json @@ -1,6 +1,6 @@ { "name": "@examples/nextjs-esm", - "version": "0.1.12", + "version": "0.1.13", "private": true, "scripts": { "dev": "next dev", diff --git a/packages/http-exception/CHANGELOG.md b/packages/http-exception/CHANGELOG.md index 233f4e9..4cf5943 100644 --- a/packages/http-exception/CHANGELOG.md +++ b/packages/http-exception/CHANGELOG.md @@ -1,5 +1,48 @@ # @belgattitude/http-exception +## 1.1.0 + +### Minor Changes + +- [#33](https://github.com/belgattitude/http-exception/pull/33) [`67be0fb`](https://github.com/belgattitude/http-exception/commit/67be0fbbb1acafa2c12a8c5a45b30f8b79ad3c4c) Thanks [@belgattitude](https://github.com/belgattitude)! - Add HttpException json serializer. + + Two new methods `fromJson` and `toJson` exported from `@belgattitude/http-exception/serializer`. + + HttpException can be serialized to json and vice-versa. It can be useful in ssr frameworks such as + [nextjs](https://nextjs.org/) whenever a server error should be shared within the browser context (see also + the excellent [superjson](https://github.com/blitz-js/superjson#recipes)). + + Serialization supports the [Error.cause](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause) + but totally ignores it the runtime (node or browser) does not support it (or without polyfills). + + Additionally, you can pass any native errors (`Error`, `EvalError`, `RangeError`, `ReferenceError`, `SyntaxError`, `TypeError`, `URIError`) + as well as a custom one (the later will be transformed to the base type Error). That was necessary to support the cause param. + + | Method | + | ------------------------------------------------------------------- | + | **toJson**(HttpException | NativeError | Error): string | + | **fromJson**(string): HttpException | NativeError | Error | + + ```typescript + import { + HttpForbidden, + HttpUnavailableForLegalReasons, + } from '@belgattitude/http-exception'; + import { fromJson, toJson } from '@belgattitude/http-exception/serializer'; + + const e = new HttpForbidden({ + url: 'https://www.cool.me', + /* + cause: new HttpUnavailableForLegalReasons({ + cause: new Error('example with cause') + }), + */ + }); + + const json = toJson(e); + const exception = fromJson(json); // e === exception + ``` + ## 1.0.2 ### Patch Changes diff --git a/packages/http-exception/package.json b/packages/http-exception/package.json index 0c6d58f..4b9388f 100644 --- a/packages/http-exception/package.json +++ b/packages/http-exception/package.json @@ -1,6 +1,6 @@ { "name": "@belgattitude/http-exception", - "version": "1.0.2", + "version": "1.1.0", "license": "MIT", "homepage": "https://github.com/belgattitude/http-exception", "repository": {