Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hello-nrfcloud/proto
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v15.3.63
Choose a base ref
...
head repository: hello-nrfcloud/proto
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v15.4.0
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Mar 19, 2025

  1. feat: add ProblemDetailError

    coderbyheart committed Mar 19, 2025

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    d842632 View commit details
Showing with 12 additions and 0 deletions.
  1. +12 −0 hello/errors/ProblemDetail.ts
12 changes: 12 additions & 0 deletions hello/errors/ProblemDetail.ts
Original file line number Diff line number Diff line change
@@ -2,6 +2,18 @@ import { Type, type Static } from '@sinclair/typebox'
import { Context } from '../Context.js'
import { HttpStatusCode, StatusCode } from './StatusCode.js'

/**
* Can be used to throw an error with a Problem Detail object.
*/
export class ProblemDetailError extends Error {
public readonly problem: Static<typeof ProblemDetail>
constructor(problem: Omit<Static<typeof ProblemDetail>, '@context'>) {
super(problem.title)
this.problem = { '@context': Context.problemDetail.toString(), ...problem }
this.name = 'ProblemDetailError'
}
}

/**
* Problem Details Object
*