hono-problem-details 0.3.0 → 0.4.0

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/README.md CHANGED
@@ -380,7 +380,7 @@ problemDetailsHandler({
380
380
  // Default type URI (default: "about:blank")
381
381
  defaultType: "about:blank",
382
382
 
383
- // Include stack trace in detail (for development)
383
+ // Include stack trace in `extensions.stack` on 500 responses (development only)
384
384
  includeStack: process.env.NODE_ENV === "development",
385
385
 
386
386
  // Populate `instance` from `c.req.path` when the thrown problem didn't specify one
package/dist/index.cjs CHANGED
@@ -211,7 +211,8 @@ function problemDetailsHandler(options = {}) {
211
211
  status: 500,
212
212
  type: buildType(500, options),
213
213
  title: "Internal Server Error",
214
- detail: options.includeStack ? error.stack : void 0
214
+ detail: "An unexpected error occurred",
215
+ extensions: options.includeStack ? { stack: error.stack } : void 0
215
216
  },
216
217
  c,
217
218
  options
package/dist/index.d.cts CHANGED
@@ -38,7 +38,12 @@ interface ProblemDetailsHandlerOptions {
38
38
  typePrefix?: string;
39
39
  /** Default type URI. Defaults to "about:blank" */
40
40
  defaultType?: string;
41
- /** Include stack trace in detail (for development) */
41
+ /**
42
+ * Include the stack trace on unhandled `Error` responses (500). The stack is
43
+ * emitted as a top-level `stack` extension member per RFC 9457 §3.1 flattening,
44
+ * not in `detail`, to prevent leakage into UIs that render `detail` verbatim.
45
+ * Development-only.
46
+ */
42
47
  includeStack?: boolean;
43
48
  /**
44
49
  * When `true`, populate `instance` from the request path (`c.req.path`) if
package/dist/index.d.ts CHANGED
@@ -38,7 +38,12 @@ interface ProblemDetailsHandlerOptions {
38
38
  typePrefix?: string;
39
39
  /** Default type URI. Defaults to "about:blank" */
40
40
  defaultType?: string;
41
- /** Include stack trace in detail (for development) */
41
+ /**
42
+ * Include the stack trace on unhandled `Error` responses (500). The stack is
43
+ * emitted as a top-level `stack` extension member per RFC 9457 §3.1 flattening,
44
+ * not in `detail`, to prevent leakage into UIs that render `detail` verbatim.
45
+ * Development-only.
46
+ */
42
47
  includeStack?: boolean;
43
48
  /**
44
49
  * When `true`, populate `instance` from the request path (`c.req.path`) if
package/dist/index.js CHANGED
@@ -84,7 +84,8 @@ function problemDetailsHandler(options = {}) {
84
84
  status: 500,
85
85
  type: buildType(500, options),
86
86
  title: "Internal Server Error",
87
- detail: options.includeStack ? error.stack : void 0
87
+ detail: "An unexpected error occurred",
88
+ extensions: options.includeStack ? { stack: error.stack } : void 0
88
89
  },
89
90
  c,
90
91
  options
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono-problem-details",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "RFC 9457 Problem Details middleware for Hono",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",