File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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" : {
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" ,
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 },
Original file line number Diff line number Diff line change 11import { HttpError } from "@fastify/sensible" ;
22import { 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
88export const errorHandler = (
99 error : Error ,
Original file line number Diff line number Diff line change @@ -19,3 +19,5 @@ declare module "@prefabs.tech/fastify-config" {
1919export { default } from "./plugin" ;
2020
2121export type { ErrorResponse } from "./types" ;
22+
23+ export type { HttpErrors } from "@fastify/sensible" ;
Original file line number Diff line number Diff line change 1- import { StackFrame } from "./httpError" ;
1+ interface StackFrame {
2+ columnNumber : number ;
3+ fileName : string ;
4+ functionName : string ;
5+ lineNumber : number ;
6+ }
27
38type ErrorResponse = {
49 code : string ;
@@ -8,4 +13,4 @@ type ErrorResponse = {
813 statusCode : number ;
914} ;
1015
11- export type { ErrorResponse } ;
16+ export type { ErrorResponse , StackFrame } ;
Original file line number Diff line number Diff line change 1- export interface StackFrame {
2- columnNumber : number ;
3- fileName : string ;
4- functionName : string ;
5- lineNumber : number ;
6- }
1+ import type { StackFrame } from "../types" ;
72
83export 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 ( / a t \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 ( / a t \s + ( .+ ?) : ( \d + ) : ( \d + ) / ) ;
3023
3124 if ( simpleMatch ) {
Original file line number Diff line number Diff line change 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" ,
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" ,
You can’t perform that action at this time.
0 commit comments