@ruiapp/rapid-core 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +11 -6
- package/package.json +1 -1
- package/src/server.ts +11 -10
package/dist/index.js
CHANGED
|
@@ -4585,12 +4585,17 @@ class RapidServer {
|
|
|
4585
4585
|
await this.#buildedRoutes(routeContext, next);
|
|
4586
4586
|
}
|
|
4587
4587
|
catch (ex) {
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
error
|
|
4591
|
-
message: ex
|
|
4592
|
-
}
|
|
4593
|
-
}
|
|
4588
|
+
let error;
|
|
4589
|
+
if (lodash.isString(ex)) {
|
|
4590
|
+
error = {
|
|
4591
|
+
message: ex,
|
|
4592
|
+
};
|
|
4593
|
+
}
|
|
4594
|
+
else {
|
|
4595
|
+
error = { name: ex.name, message: ex.message, stack: ex.stack };
|
|
4596
|
+
}
|
|
4597
|
+
this.#logger.error("handle request error.", { error });
|
|
4598
|
+
response.json({ error }, 500);
|
|
4594
4599
|
}
|
|
4595
4600
|
if (!response.status && !response.body) {
|
|
4596
4601
|
response.json({
|
package/package.json
CHANGED
package/src/server.ts
CHANGED
|
@@ -30,7 +30,7 @@ import { Next, RouteContext } from "./core/routeContext";
|
|
|
30
30
|
import { RapidRequest } from "./core/request";
|
|
31
31
|
import bootstrapApplicationConfig from "./bootstrapApplicationConfig";
|
|
32
32
|
import EntityManager from "./dataAccess/entityManager";
|
|
33
|
-
import { bind, cloneDeep, find, forEach, merge, omit } from "lodash";
|
|
33
|
+
import { bind, cloneDeep, find, forEach, isString, merge, omit } from "lodash";
|
|
34
34
|
import { Logger } from "./facilities/log/LogFacility";
|
|
35
35
|
import { FacilityFactory } from "./core/facility";
|
|
36
36
|
import { CronJobConfiguration } from "./types/cron-job-types";
|
|
@@ -443,15 +443,16 @@ export class RapidServer implements IRpdServer {
|
|
|
443
443
|
await this.#pluginManager.onPrepareRouteContext(routeContext);
|
|
444
444
|
await this.#buildedRoutes(routeContext, next);
|
|
445
445
|
} catch (ex) {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
{
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
);
|
|
446
|
+
let error: any;
|
|
447
|
+
if (isString(ex)) {
|
|
448
|
+
error = {
|
|
449
|
+
message: ex,
|
|
450
|
+
};
|
|
451
|
+
} else {
|
|
452
|
+
error = { name: ex.name, message: ex.message, stack: ex.stack };
|
|
453
|
+
}
|
|
454
|
+
this.#logger.error("handle request error.", { error });
|
|
455
|
+
response.json({ error }, 500);
|
|
455
456
|
}
|
|
456
457
|
|
|
457
458
|
if (!response.status && !response.body) {
|