Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 0e02987

Browse files
committed
export report error
1 parent fc2e264 commit 0e02987

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/apitoolkit.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ type Config = {
1414
};
1515
export declare function expressMiddleware(config?: Config): (req: Request, res: Response, next: NextFunction) => void;
1616
export declare function expressErrorHandler(err: Error, _req: Request, _res: Response, next: NextFunction): void;
17+
export declare const reportError: typeof ReportError;
1718
declare const APIToolkit: {
1819
expressMiddleware: typeof expressMiddleware;
1920
expressErrorHandler: typeof expressErrorHandler;

lib/apitoolkit.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3-
exports.ReportError = void 0;
3+
exports.reportError = exports.ReportError = void 0;
44
exports.expressMiddleware = expressMiddleware;
55
exports.expressErrorHandler = expressErrorHandler;
66
const uuid_1 = require("uuid");
@@ -158,7 +158,7 @@ const findMatchedRoute = (app, method, url) => {
158158
return '';
159159
}
160160
};
161-
const reportError = apitoolkit_js_1.ReportError;
161+
exports.reportError = apitoolkit_js_1.ReportError;
162162
function transformPath(params, path) {
163163
let transformedPath = path;
164164
for (const [key, value] of Object.entries(params)) {
@@ -170,6 +170,6 @@ function transformPath(params, path) {
170170
const APIToolkit = {
171171
expressMiddleware,
172172
expressErrorHandler,
173-
reportError
173+
reportError: exports.reportError
174174
};
175175
exports.default = APIToolkit;

src/apitoolkit.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Span, trace } from '@opentelemetry/api';
33
import { Application, NextFunction, Request, Response } from 'express';
44
import { redactFields } from 'apitoolkit-js/lib/payload';
55
import { asyncLocalStorage, ReportError } from 'apitoolkit-js';
6-
export { ReportError } from 'apitoolkit-js';
76

87
type Config = {
98
serviceName?: string;
@@ -171,7 +170,7 @@ const findMatchedRoute = (app: Application, method: string, url: string): string
171170
}
172171
};
173172

174-
const reportError = ReportError;
173+
export const reportError = ReportError;
175174

176175
function transformPath(params: Record<string, string>, path: string): string {
177176
let transformedPath = path;

0 commit comments

Comments
 (0)