generated from huang-julien/nitro-module-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: keep context within main renderer and error renderer (#16)
- Loading branch information
1 parent
8dc0e9b
commit 93a1530
Showing
4 changed files
with
52 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { context } from "@opentelemetry/api"; | ||
import { NitroErrorHandler } from "nitropack"; | ||
// @ts-ignore - alias | ||
import errorRenderer from "#nitro-error-handler"; | ||
|
||
export default <NitroErrorHandler>((error, event) => { | ||
return context.with(event.otel.ctx, (errorRenderer as NitroErrorHandler), undefined, error, event) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { context } from '@opentelemetry/api'; | ||
// @ts-ignore - alias | ||
import renderer from "#nitro-renderer" | ||
import { eventHandler } from "h3" | ||
|
||
export default eventHandler((e) => { | ||
return context.with(e.otel.ctx, renderer, undefined, e) | ||
}) |