diff --git a/lib/server/start.js b/lib/server/start.js index f59ad0e..fded2be 100644 --- a/lib/server/start.js +++ b/lib/server/start.js @@ -200,7 +200,7 @@ async function startup(path, connector, omitWatchers, omitTimers, routine) { catch (err) { console.error(err); const { request } = ctx; - const exception = err instanceof types_1.OakException + const exception = (0, types_1.isOakException)(err) ? err : new types_1.OakException(serverConfiguration?.internalExceptionMask || ExceptionMask); diff --git a/src/server/start.ts b/src/server/start.ts index ad1ad64..126bcd9 100644 --- a/src/server/start.ts +++ b/src/server/start.ts @@ -9,7 +9,7 @@ import KoaBody from 'koa-body'; import { AppLoader, getClusterInfo, ClusterAppLoader } from 'oak-backend-base'; import { BackendRuntimeContext } from 'oak-frontend-base/lib/context/BackendRuntimeContext'; -import { OakException, Connector, EntityDict, ClusterInfo, OpRecord } from 'oak-domain/lib/types'; +import { OakException, Connector, EntityDict, ClusterInfo, OpRecord, isOakException } from 'oak-domain/lib/types'; import { EntityDict as BaseEntityDict } from 'oak-domain/lib/base-app-domain'; import { AsyncRowStore, AsyncContext } from 'oak-domain/lib/store/AsyncRowStore'; import { SyncContext } from 'oak-domain/lib/store/SyncRowStore'; @@ -245,7 +245,7 @@ export async function startup( serverConfiguration?.internalExceptionMask ||