Skip to content

Commit fd4fd4b

Browse files
committed
feat: export SecurityError
1 parent 8537f99 commit fd4fd4b

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

index.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ export interface FastifyOpenapiGlueOptions {
3232
}
3333

3434
declare const fastifyOpenapiGlue: FastifyPluginAsync<FastifyOpenapiGlueOptions>;
35+
declare interface SecurityError extends Error {
36+
statusCode: number;
37+
name: string;
38+
errors: Error[];
39+
}
3540

3641
export default fastifyOpenapiGlue;
3742
export { fastifyOpenapiGlue };
43+
export type { SecurityError };

index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import fp from "fastify-plugin";
22
import { Parser } from "./lib/Parser.js";
3-
import SecurityHandlers from "./lib/securityHandlers.js";
3+
import { SecurityError, SecurityHandlers } from "./lib/securityHandlers.js";
44

55
function checkObject(obj, name) {
66
if (typeof obj === "object" && obj !== null) {
@@ -161,7 +161,7 @@ const fastifyOpenapiGlue = fp(plugin, {
161161
});
162162

163163
export default fastifyOpenapiGlue;
164-
export { fastifyOpenapiGlue };
164+
export { fastifyOpenapiGlue, SecurityError };
165165

166166
export const options = {
167167
specification: "examples/petstore/petstore-openapi.v3.json",

lib/securityHandlers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class SecurityError extends Error {
99
}
1010
}
1111

12-
export default class SecurityHandlers {
12+
export class SecurityHandlers {
1313
/** constructor */
1414
constructor(handlers) {
1515
this.handlers = handlers;

0 commit comments

Comments
 (0)