diff --git a/fastify.d.ts b/fastify.d.ts index bb4c9038dd..f8d10af269 100644 --- a/fastify.d.ts +++ b/fastify.d.ts @@ -10,7 +10,7 @@ import { FastifyInstance } from './types/instance' import { FastifyServerFactory } from './types/serverFactory' import { Options as AjvOptions } from '@fastify/ajv-compiler' import { Options as FJSOptions } from '@fastify/fast-json-stringify-compiler' -import { FastifyError } from 'fastify-error' +import { FastifyError } from '@fastify/error' import { FastifyReply } from './types/reply' import { FastifySchemaValidationError } from './types/schema' import { ConstructorAction, ProtoAction } from "./types/content-type-parser"; @@ -174,7 +174,7 @@ export type FastifyServerOptions< type TrustProxyFunction = (address: string, hop: number) => boolean -declare module 'fastify-error' { +declare module '@fastify/error' { interface FastifyError { validation?: ValidationResult[]; } @@ -199,7 +199,7 @@ export { FastifyContext, FastifyContextConfig } from './types/context' export { RouteHandler, RouteHandlerMethod, RouteOptions, RouteShorthandMethod, RouteShorthandOptions, RouteShorthandOptionsWithHandler } from './types/route' export * from './types/register' export { FastifyBodyParser, FastifyContentTypeParser, AddContentTypeParser, hasContentTypeParser, getDefaultJsonParser, ProtoAction, ConstructorAction } from './types/content-type-parser' -export { FastifyError } from 'fastify-error' +export { FastifyError } from '@fastify/error' export { FastifySchema, FastifySchemaCompiler } from './types/schema' export { HTTPMethods, RawServerBase, RawRequestDefaultExpression, RawReplyDefaultExpression, RawServerDefault, ContextConfigDefault, RequestBodyDefault, RequestQuerystringDefault, RequestParamsDefault, RequestHeadersDefault } from './types/utils' export * from './types/hooks' diff --git a/lib/errors.js b/lib/errors.js index 368c2172a8..c128b0b69d 100644 --- a/lib/errors.js +++ b/lib/errors.js @@ -1,6 +1,6 @@ 'use strict' -const createError = require('fastify-error') +const createError = require('@fastify/error') const codes = { /** * Basic diff --git a/package.json b/package.json index b204922017..1bbd0d5ce2 100644 --- a/package.json +++ b/package.json @@ -176,10 +176,10 @@ }, "dependencies": { "@fastify/ajv-compiler": "^3.1.0", + "@fastify/error": "^2.0.0", "@fastify/fast-json-stringify-compiler": "^1.0.0", "abstract-logging": "^2.0.1", "avvio": "^8.1.0", - "fastify-error": "^1.1.0", "find-my-way": "^5.3.0", "light-my-request": "^4.7.0", "pino": "^7.5.1", diff --git a/test/types/hooks.test-d.ts b/test/types/hooks.test-d.ts index 8629cf7c1f..d9d17bb506 100644 --- a/test/types/hooks.test-d.ts +++ b/test/types/hooks.test-d.ts @@ -1,4 +1,4 @@ -import { FastifyError } from 'fastify-error' +import { FastifyError } from '@fastify/error' import { expectAssignable, expectError, expectType } from 'tsd' import fastify, { FastifyInstance, diff --git a/test/types/plugin.test-d.ts b/test/types/plugin.test-d.ts index 206b3d46f1..566ec6682b 100644 --- a/test/types/plugin.test-d.ts +++ b/test/types/plugin.test-d.ts @@ -3,7 +3,7 @@ import * as http from 'http' import * as https from 'https' import { expectType, expectError, expectAssignable } from 'tsd' import { FastifyPluginCallback, FastifyPluginAsync } from '../../types/plugin' -import { FastifyError } from 'fastify-error' +import { FastifyError } from '@fastify/error' // FastifyPlugin & FastifyRegister interface TestOptions extends FastifyPluginOptions { diff --git a/test/types/route.test-d.ts b/test/types/route.test-d.ts index b01be12f87..df02fde857 100644 --- a/test/types/route.test-d.ts +++ b/test/types/route.test-d.ts @@ -3,7 +3,7 @@ import { expectType, expectError, expectAssignable, printType } from 'tsd' import { HTTPMethods } from '../../types/utils' import * as http from 'http' import { RequestPayload } from '../../types/hooks' -import { FastifyError } from 'fastify-error' +import { FastifyError } from '@fastify/error' /* * Testing Fastify HTTP Routes and Route Shorthands. diff --git a/types/hooks.d.ts b/types/hooks.d.ts index 268f6c2690..95025e20c6 100644 --- a/types/hooks.d.ts +++ b/types/hooks.d.ts @@ -4,7 +4,7 @@ import { RouteOptions, RouteGenericInterface } from './route' import { RawServerBase, RawServerDefault, RawRequestDefaultExpression, RawReplyDefaultExpression, ContextConfigDefault } from './utils' import { FastifyRequest } from './request' import { FastifyReply } from './reply' -import { FastifyError } from 'fastify-error' +import { FastifyError } from '@fastify/error' import { FastifyLoggerInstance } from './logger' import { FastifyRequestType, diff --git a/types/instance.d.ts b/types/instance.d.ts index 1ff59d0630..4d2e05a256 100644 --- a/types/instance.d.ts +++ b/types/instance.d.ts @@ -1,4 +1,4 @@ -import { FastifyError } from 'fastify-error' +import { FastifyError } from '@fastify/error' import { CallbackFunc as LightMyRequestCallback, Chain as LightMyRequestChain, InjectOptions, Response as LightMyRequestResponse } from 'light-my-request' import { AddContentTypeParser, ConstructorAction, FastifyBodyParser, getDefaultJsonParser, hasContentTypeParser, ProtoAction, removeAllContentTypeParsers, removeContentTypeParser } from './content-type-parser' import { onCloseAsyncHookHandler, onCloseHookHandler, onErrorAsyncHookHandler, onErrorHookHandler, onReadyAsyncHookHandler, onReadyHookHandler, onRegisterHookHandler, onRequestAsyncHookHandler, onRequestHookHandler, onResponseAsyncHookHandler, onResponseHookHandler, onRouteHookHandler, onSendAsyncHookHandler, onSendHookHandler, onTimeoutAsyncHookHandler, onTimeoutHookHandler, preHandlerAsyncHookHandler, preHandlerHookHandler, preParsingAsyncHookHandler, preParsingHookHandler, preSerializationAsyncHookHandler, preSerializationHookHandler, preValidationAsyncHookHandler, preValidationHookHandler } from './hooks' diff --git a/types/logger.d.ts b/types/logger.d.ts index fffdab4634..b1f8498663 100644 --- a/types/logger.d.ts +++ b/types/logger.d.ts @@ -1,4 +1,4 @@ -import { FastifyError } from 'fastify-error' +import { FastifyError } from '@fastify/error' import { RouteGenericInterface } from './route' import { FastifyRequest } from './request' import { FastifyReply } from './reply' diff --git a/types/route.d.ts b/types/route.d.ts index 77401cb0ec..3b3fa95b9d 100644 --- a/types/route.d.ts +++ b/types/route.d.ts @@ -4,7 +4,7 @@ import { FastifyReply, ReplyGenericInterface } from './reply' import { FastifySchema, FastifySchemaCompiler, FastifySchemaValidationError, FastifySerializerCompiler } from './schema' import { HTTPMethods, RawServerBase, RawServerDefault, RawRequestDefaultExpression, RawReplyDefaultExpression, ContextConfigDefault } from './utils' import { preValidationHookHandler, preHandlerHookHandler, preSerializationHookHandler, onRequestHookHandler, preParsingHookHandler, onResponseHookHandler, onSendHookHandler, onErrorHookHandler, onTimeoutHookHandler } from './hooks' -import { FastifyError } from 'fastify-error' +import { FastifyError } from '@fastify/error' import { FastifyContext } from './context' import { FastifyRequestType,