Skip to content

Commit

Permalink
refactor!: move to httpx/exception for error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
belgattitude committed Nov 21, 2022
1 parent 7a5d942 commit a4d7b13
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion examples/next-classic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"fix-staged": "lint-staged --allow-empty"
},
"dependencies": {
"@belgattitude/http-exception": "1.4.0",
"@httpx/exception": "1.6.0",
"@nextvalid/zod-request": "workspace:^",
"axios": "1.1.3",
"ky": "0.32.2",
Expand Down
4 changes: 2 additions & 2 deletions examples/next-classic/src/backend/parseRequestWithZod.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { IncomingMessage } from 'node:http';
import type { HttpException } from '@belgattitude/http-exception';
import { HttpBadRequest } from '@belgattitude/http-exception';
import type { HttpException } from '@httpx/exception';
import { HttpBadRequest } from '@httpx/exception';
import type { NextApiRequest } from 'next';
import type { z, ZodSchema } from 'zod';

Expand Down
6 changes: 3 additions & 3 deletions examples/next-classic/src/backend/withApiErrorHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { HttpException } from '@belgattitude/http-exception';
import { isHttpException } from '@belgattitude/http-exception';
import { convertToSerializable } from '@belgattitude/http-exception/serializer';
import type { HttpException } from '@httpx/exception';
import { isHttpException } from '@httpx/exception';
import { convertToSerializable } from '@httpx/exception/serializer';
import type { NextApiRequest, NextApiResponse } from 'next';
import type { LoggerInterface } from '@/lib';
import { ConsoleLogger } from '@/lib';
Expand Down
2 changes: 1 addition & 1 deletion examples/next-classic/src/lib/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* @see https://github.com/belgattitude/http-exception
*/
import { isHttpException } from '@belgattitude/http-exception';
import { isHttpException } from '@httpx/exception';

export interface LoggerInterface {
log<T = unknown>(message: string, payload?: T): void;
Expand Down
3 changes: 1 addition & 2 deletions packages/zod-request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"fix-all-files": "eslint . --ext .ts,.tsx,.js,.jsx,.mjs,.cjs,.mts,.cts --fix"
},
"dependencies": {
"@belgattitude/http-exception": "^1.4.0",
"@httpx/exception": "^1.6.0",
"zod": "^3.19.1"
},
"peerDependencies": {
Expand All @@ -85,7 +85,6 @@
},
"devDependencies": {
"@belgattitude/eslint-config-bases": "1.12.0",
"@belgattitude/http-exception": "1.4.0",
"@size-limit/file": "8.1.0",
"@size-limit/webpack": "8.1.0",
"@size-limit/webpack-why": "8.1.0",
Expand Down
5 changes: 1 addition & 4 deletions packages/zod-request/src/error/HttpExceptionHandler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
HttpBadRequest,
HttpMethodNotAllowed,
} from '@belgattitude/http-exception';
import { HttpBadRequest, HttpMethodNotAllowed } from '@httpx/exception';
import type { z } from 'zod';
import type { IErrorHandler } from './IErrorHandler';

Expand Down
5 changes: 1 addition & 4 deletions packages/zod-request/test/zodReq.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
HttpBadRequest,
HttpMethodNotAllowed,
} from '@belgattitude/http-exception';
import { HttpBadRequest, HttpMethodNotAllowed } from '@httpx/exception';
import { z } from 'zod';
import { zodReq } from '../src';
import { createNextRequest } from './_helpers';
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -488,13 +488,6 @@ __metadata:
languageName: node
linkType: hard

"@belgattitude/http-exception@npm:1.4.0":
version: 1.4.0
resolution: "@belgattitude/http-exception@npm:1.4.0"
checksum: ea3ffe486e6693e3bc35b2d20a17ededee26aa391ae38169cf83f29463aa30523a88e42009be6a515fb6462182d748b19c825f4b368f0bb433c2cf1483869d42
languageName: node
linkType: hard

"@changesets/apply-release-plan@npm:^6.1.2":
version: 6.1.2
resolution: "@changesets/apply-release-plan@npm:6.1.2"
Expand Down Expand Up @@ -1026,7 +1019,7 @@ __metadata:
resolution: "@examples/next-classic@workspace:examples/next-classic"
dependencies:
"@belgattitude/eslint-config-bases": "npm:1.12.0"
"@belgattitude/http-exception": "npm:1.4.0"
"@httpx/exception": "npm:1.6.0"
"@nextvalid/zod-request": "workspace:^"
"@types/node": "npm:18.11.9"
"@types/react": "npm:18.0.25"
Expand Down Expand Up @@ -1280,6 +1273,13 @@ __metadata:
languageName: node
linkType: hard

"@httpx/exception@npm:1.6.0, @httpx/exception@npm:^1.6.0":
version: 1.6.0
resolution: "@httpx/exception@npm:1.6.0"
checksum: 9e5c59107ad65b8559a9daccbbdcfa9265e60eec635ae348c1ad046761a82c0efe5fe1463cde5eea1c919544a47753cf0a7a14530d7409d9ba021a976179aec9
languageName: node
linkType: hard

"@humanwhocodes/config-array@npm:^0.11.6":
version: 0.11.7
resolution: "@humanwhocodes/config-array@npm:0.11.7"
Expand Down Expand Up @@ -1772,7 +1772,7 @@ __metadata:
resolution: "@nextvalid/zod-request@workspace:packages/zod-request"
dependencies:
"@belgattitude/eslint-config-bases": "npm:1.12.0"
"@belgattitude/http-exception": "npm:1.4.0"
"@httpx/exception": "npm:^1.6.0"
"@size-limit/file": "npm:8.1.0"
"@size-limit/webpack": "npm:8.1.0"
"@size-limit/webpack-why": "npm:8.1.0"
Expand Down

0 comments on commit a4d7b13

Please sign in to comment.