Skip to content

Commit 56de665

Browse files
committed
refactor: move ProblemDetailError to @hello.nrfcloud.com/proto
BREAKING CHANGE: use ProblemDetailError from @hello.nrfcloud.com/proto/hello
1 parent d23de31 commit 56de665

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"prettier": "@bifravst/prettier-config",
8383
"peerDependencies": {
8484
"@aws-lambda-powertools/metrics": "^2.16.0",
85-
"@hello.nrfcloud.com/proto": "^15.3.63",
85+
"@hello.nrfcloud.com/proto": "^15.4.0",
8686
"@middy/core": "^6.1.5",
8787
"@middy/input-output-logger": "^6.1.5"
8888
}

src/problemResponse.ts

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { formatTypeBoxErrors } from '@hello.nrfcloud.com/proto'
22
import {
3-
Context,
43
HttpStatusCode,
5-
type ProblemDetail,
4+
ProblemDetailError,
65
} from '@hello.nrfcloud.com/proto/hello'
76
import type { MiddlewareObj } from '@middy/core'
8-
import type { Static } from '@sinclair/typebox'
97
import type {
108
APIGatewayProxyEventV2,
119
APIGatewayProxyStructuredResultV2,
@@ -15,15 +13,6 @@ import { aProblem } from './aProblem.js'
1513
import { ValidationFailedError } from './validateInput.js'
1614
import { ResponseValidationFailedError } from './validateResponse.js'
1715

18-
export class ProblemDetailError extends Error {
19-
public readonly problem: Static<typeof ProblemDetail>
20-
constructor(problem: Omit<Static<typeof ProblemDetail>, '@context'>) {
21-
super(problem.title)
22-
this.problem = { '@context': Context.problemDetail.toString(), ...problem }
23-
this.name = 'ProblemDetailError'
24-
}
25-
}
26-
2716
export const problemResponse = (): MiddlewareObj<
2817
APIGatewayProxyEventV2,
2918
APIGatewayProxyStructuredResultV2,

0 commit comments

Comments
 (0)