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

fix(core): avoid unexpected 500 error #6515

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"got": "^14.0.0",
"hash-wasm": "^4.11.0",
"helmet": "^7.1.0",
"http-errors": "^2.0.0",
"i18next": "^22.4.15",
"iconv-lite": "0.6.3",
"jose": "^5.6.3",
Expand Down Expand Up @@ -101,6 +102,7 @@
"@types/adm-zip": "^0.5.5",
"@types/debug": "^4.1.7",
"@types/etag": "^1.8.1",
"@types/http-errors": "^2.0.4",
"@types/jest": "^29.4.0",
"@types/koa": "^2.15.0",
"@types/koa-compose": "^3.2.5",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/middleware/koa-error-handler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { appInsights } from '@logto/app-insights/node';
import type { RequestErrorBody } from '@logto/schemas';
import { isHttpError } from 'http-errors';
import type { Middleware } from 'koa';
import { HttpError } from 'koa';

import { EnvSet } from '#src/env-set/index.js';
import RequestError from '#src/errors/RequestError/index.js';
Expand Down Expand Up @@ -39,7 +39,7 @@ export default function koaErrorHandler<StateT, ContextT, BodyT>(): Middleware<
}

// Koa will handle `HttpError` with a built-in manner.
if (error instanceof HttpError) {
if (isHttpError(error)) {
return;
}

Expand Down
Loading
Loading