@feathersjs/koa 5.0.0-pre.30 → 5.0.0-pre.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [5.0.0-pre.31](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.30...v5.0.0-pre.31) (2022-10-12)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **koa:** Only set error code for Feathers errors ([#2793](https://github.com/feathersjs/feathers/issues/2793)) ([d3ee41e](https://github.com/feathersjs/feathers/commit/d3ee41e27b0ea5d29b344d6584ab03e48d16e2b4))
11
+
12
+ ### Features
13
+
14
+ - **cli:** Generate full client test suite and improve typed client ([#2788](https://github.com/feathersjs/feathers/issues/2788)) ([57119b6](https://github.com/feathersjs/feathers/commit/57119b6bb2797f7297cf054268a248c093ecd538))
15
+
6
16
  # [5.0.0-pre.30](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.29...v5.0.0-pre.30) (2022-10-07)
7
17
 
8
18
  ### Bug Fixes
package/lib/handlers.js CHANGED
@@ -6,11 +6,11 @@ const errorHandler = () => async (ctx, next) => {
6
6
  try {
7
7
  await next();
8
8
  if (ctx.body === undefined) {
9
- throw new errors_1.NotFound('Not Found');
9
+ throw new errors_1.NotFound(`Path ${ctx.path} not found`);
10
10
  }
11
11
  }
12
12
  catch (error) {
13
- ctx.response.status = error.code || 500;
13
+ ctx.response.status = error instanceof errors_1.FeathersError ? error.code : 500;
14
14
  ctx.body =
15
15
  typeof error.toJSON === 'function'
16
16
  ? error.toJSON()
@@ -1 +1 @@
1
- {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":";;;AAAA,+CAA6C;AAGtC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,KAAK,EAAE,GAAuB,EA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BAgBxB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@feathersjs/koa",
3
3
  "description": "Feathers KoaJS framework bindings and REST provider",
4
- "version": "5.0.0-pre.30",
4
+ "version": "5.0.0-pre.31",
5
5
  "homepage": "https://feathersjs.com",
6
6
  "main": "lib/",
7
7
  "types": "lib/",
@@ -49,10 +49,10 @@
49
49
  "access": "public"
50
50
  },
51
51
  "dependencies": {
52
- "@feathersjs/authentication": "^5.0.0-pre.30",
53
- "@feathersjs/commons": "^5.0.0-pre.30",
54
- "@feathersjs/errors": "^5.0.0-pre.30",
55
- "@feathersjs/transport-commons": "^5.0.0-pre.30",
52
+ "@feathersjs/authentication": "^5.0.0-pre.31",
53
+ "@feathersjs/commons": "^5.0.0-pre.31",
54
+ "@feathersjs/errors": "^5.0.0-pre.31",
55
+ "@feathersjs/transport-commons": "^5.0.0-pre.31",
56
56
  "@koa/cors": "^3.4.2",
57
57
  "@types/koa": "^2.13.5",
58
58
  "@types/koa-bodyparser": "^4.3.8",
@@ -64,10 +64,10 @@
64
64
  "koa-qs": "^3.0.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@feathersjs/authentication-local": "^5.0.0-pre.30",
68
- "@feathersjs/feathers": "^5.0.0-pre.30",
69
- "@feathersjs/memory": "^5.0.0-pre.30",
70
- "@feathersjs/tests": "^5.0.0-pre.30",
67
+ "@feathersjs/authentication-local": "^5.0.0-pre.31",
68
+ "@feathersjs/feathers": "^5.0.0-pre.31",
69
+ "@feathersjs/memory": "^5.0.0-pre.31",
70
+ "@feathersjs/tests": "^5.0.0-pre.31",
71
71
  "@types/koa-compose": "^3.2.5",
72
72
  "@types/mocha": "^10.0.0",
73
73
  "@types/node": "^18.8.2",
@@ -77,5 +77,5 @@
77
77
  "ts-node": "^10.9.1",
78
78
  "typescript": "^4.8.4"
79
79
  },
80
- "gitHead": "b535c91197f4b997520e0a0e608793eeba791931"
80
+ "gitHead": "4500dbeb8cea566678cf88b3313a88efd93a2ed9"
81
81
  }
package/src/handlers.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { NotFound } from '@feathersjs/errors'
1
+ import { FeathersError, NotFound } from '@feathersjs/errors'
2
2
  import { FeathersKoaContext } from './declarations'
3
3
 
4
4
  export const errorHandler = () => async (ctx: FeathersKoaContext, next: () => Promise<any>) => {
@@ -6,10 +6,10 @@ export const errorHandler = () => async (ctx: FeathersKoaContext, next: () => Pr
6
6
  await next()
7
7
 
8
8
  if (ctx.body === undefined) {
9
- throw new NotFound('Not Found')
9
+ throw new NotFound(`Path ${ctx.path} not found`)
10
10
  }
11
11
  } catch (error: any) {
12
- ctx.response.status = error.code || 500
12
+ ctx.response.status = error instanceof FeathersError ? error.code : 500
13
13
  ctx.body =
14
14
  typeof error.toJSON === 'function'
15
15
  ? error.toJSON()