Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IND-458]: In case of errors in comlink log request #722

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ router.get(
'AddressesController GET /:address',
'Addresses error',
error,
req,
res,
);
}
Expand Down Expand Up @@ -308,6 +309,7 @@ router.get(
'AddressesController GET /:address/subaccountNumber/:subaccountNumber',
'Addresses subaccount error',
error,
req,
res,
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ router.get(
'AssetPositionsController GET /',
'Asset positions error',
error,
req,
res,
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ router.get(
'CandlesController GET /perpetualMarkets/:ticker',
'Candles error',
error,
req,
res,
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ router.get(
'ComplianceController GET /',
'Compliance error',
error,
req,
res,
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ router.get(
'FillsController GET /',
'Fills error',
error,
req,
res,
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ router.get(
rejectRestrictedCountries,
rateLimiterMiddleware(getReqRateLimiter),
ExportResponseCodeStats({ controllerName }),
async (_req: express.Request, res: express.Response) => {
async (req: express.Request, res: express.Response) => {
const start: number = Date.now();
try {
const controller: HeightController = new HeightController();
Expand All @@ -49,6 +49,7 @@ router.get(
'HeightController GET /',
'Height error',
error,
req,
res,
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ router.get(
'HistoricalFundingController GET /',
'HistoricalFunding error',
error,
req,
res,
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ router.get(
'HistoricalPnlController GET /',
'Historical Pnl error',
error,
req,
res,
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ router.get(
'OrderbooksController GET /perpetualMarket/:ticker',
'Orderbooks error',
error,
req,
res,
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ router.get(
'OrdersController GET /',
'Orders error',
error,
req,
res,
);
} finally {
Expand Down Expand Up @@ -300,6 +301,7 @@ router.get(
'OrdersController GET /:orderId',
'Orders error',
error,
req,
res,
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ router.get(
'PerpetualMarketController GET /',
'PerpetualMarket error',
error,
req,
res,
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ router.get(
'PerpetualPositionsController GET /',
'Perpetual positions error',
error,
req,
res,
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ router.get(
'SparklinesController GET /',
'Sparklines error',
error,
req,
res,
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ router.get(
'TradesController GET /perpetualMarket/:ticker',
'Trades error',
error,
req,
res,
);
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ router.get(
'TransfersController GET /',
'Transfers error',
error,
req,
res,
);
} finally {
Expand Down
5 changes: 5 additions & 0 deletions indexer/services/comlink/src/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function handleControllerError(
at: string,
message: string,
error: Error,
req: express.Request,
res: express.Response,
): express.Response {
if (error instanceof NotFoundError) {
Expand All @@ -57,6 +58,7 @@ export function handleControllerError(
at,
message,
error,
req,
res,
);
}
Expand All @@ -65,6 +67,7 @@ function handleInternalServerError(
at: string,
message: string,
error: Error,
req: express.Request,
res: express.Response,
): express.Response {
if (config.isDevelopment()) {
Expand All @@ -76,6 +79,8 @@ function handleInternalServerError(
at,
message,
error,
params: JSON.stringify(req.params),
query: JSON.stringify(req.query),
});
return createInternalServerErrorResponse(res);
}
Expand Down