Skip to content

Commit 3d2fcc5

Browse files
committed
chore: update version to 0.88.2 and add error handler dependency
1 parent 11bf2b6 commit 3d2fcc5

7 files changed

Lines changed: 21 additions & 15 deletions

File tree

packages/errorHandler/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@prefabs.tech/fastify-error-handler",
3-
"version": "0.88.1",
3+
"version": "0.88.2",
44
"description": "Fastify error-handler plugin",
55
"homepage": "https://github.com/prefabs-tech/fastify/tree/main/packages/error-handler#readme",
66
"repository": {
@@ -32,7 +32,7 @@
3232
"devDependencies": {
3333
"@fastify/sensible": "6.0.3",
3434
"@prefabs.tech/eslint-config": "0.2.0",
35-
"@prefabs.tech/fastify-config": "0.88.1",
35+
"@prefabs.tech/fastify-config": "0.88.2",
3636
"@prefabs.tech/tsconfig": "0.2.0",
3737
"@types/node": "20.19.9",
3838
"@typescript-eslint/eslint-plugin": "8.38.0",
@@ -55,6 +55,7 @@
5555
"vitest": "3.2.4"
5656
},
5757
"peerDependencies": {
58+
"@prefabs.tech/fastify-config": "0.88.2",
5859
"fastify": ">=5.2.1",
5960
"fastify-plugin": ">=5.0.1"
6061
},

packages/errorHandler/src/errorHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { HttpError } from "@fastify/sensible";
22
import { FastifyReply, FastifyRequest } from "fastify";
33

4-
import { parseStack, StackFrame } from "./httpError";
4+
import { parseStack } from "./utils/httpError";
55

6-
import type { ErrorResponse } from "./types";
6+
import type { ErrorResponse, StackFrame } from "./types";
77

88
export const errorHandler = (
99
error: Error,

packages/errorHandler/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ declare module "@prefabs.tech/fastify-config" {
1919
export { default } from "./plugin";
2020

2121
export type { ErrorResponse } from "./types";
22+
23+
export type { HttpErrors } from "@fastify/sensible";

packages/errorHandler/src/types.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import { StackFrame } from "./httpError";
1+
interface StackFrame {
2+
columnNumber: number;
3+
fileName: string;
4+
functionName: string;
5+
lineNumber: number;
6+
}
27

38
type ErrorResponse = {
49
code: string;
@@ -8,4 +13,4 @@ type ErrorResponse = {
813
statusCode: number;
914
};
1015

11-
export type { ErrorResponse };
16+
export type { ErrorResponse, StackFrame };

packages/errorHandler/src/httpError.ts renamed to packages/errorHandler/src/utils/httpError.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
export interface StackFrame {
2-
columnNumber: number;
3-
fileName: string;
4-
functionName: string;
5-
lineNumber: number;
6-
}
1+
import type { StackFrame } from "../types";
72

83
export const parseStack = (stack: string): StackFrame[] => {
94
// split stack into lines and remove the first line (error message)
@@ -12,7 +7,6 @@ export const parseStack = (stack: string): StackFrame[] => {
127
return stackLines
138
.map((line) => {
149
// match the stack trace line pattern
15-
// Example: " at Object.<anonymous> (/app/src/controllers/workspace.ts:42:15)"
1610
const match = line.match(/at\s+(.+?)\s+\((.+?):(\d+):(\d+)\)/);
1711

1812
if (match) {
@@ -25,7 +19,6 @@ export const parseStack = (stack: string): StackFrame[] => {
2519
}
2620

2721
// Handle cases where the stack trace format is different
28-
// Example: " at /app/src/controllers/workspace.ts:42:15"
2922
const simpleMatch = line.match(/at\s+(.+?):(\d+):(\d+)/);
3023

3124
if (simpleMatch) {

packages/user/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"@fastify/formbody": "8.0.2",
3838
"@prefabs.tech/eslint-config": "0.2.0",
3939
"@prefabs.tech/fastify-config": "0.88.2",
40+
"@prefabs.tech/fastify-error-handler": "0.88.2",
4041
"@prefabs.tech/fastify-graphql": "0.88.2",
4142
"@prefabs.tech/fastify-mailer": "0.88.2",
4243
"@prefabs.tech/fastify-s3": "0.88.2",
@@ -74,6 +75,7 @@
7475
"@fastify/cors": ">=11.0.1",
7576
"@fastify/formbody": ">=8.0.2",
7677
"@prefabs.tech/fastify-config": "0.88.2",
78+
"@prefabs.tech/fastify-error-handler": "0.88.2",
7779
"@prefabs.tech/fastify-graphql": "0.88.2",
7880
"@prefabs.tech/fastify-mailer": "0.88.2",
7981
"@prefabs.tech/fastify-s3": "0.88.2",

pnpm-lock.yaml

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)