@grupodiariodaregiao/bunstone 0.3.10 → 0.3.12
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 +6 -2
- package/lib/app-startup.ts +5 -1
- package/lib/http-exceptions.ts +6 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -99813,7 +99813,8 @@ class HttpException extends Error {
|
|
|
99813
99813
|
response;
|
|
99814
99814
|
constructor(response, status) {
|
|
99815
99815
|
const responseObj = typeof response === "string" ? { message: response } : response;
|
|
99816
|
-
|
|
99816
|
+
const message = typeof response === "string" ? response : response.message ?? JSON.stringify(response);
|
|
99817
|
+
super(message);
|
|
99817
99818
|
this.status = status;
|
|
99818
99819
|
this.response = responseObj;
|
|
99819
99820
|
Object.setPrototypeOf(this, HttpException.prototype);
|
|
@@ -117124,7 +117125,10 @@ class AppStartup {
|
|
|
117124
117125
|
errors: errors5
|
|
117125
117126
|
};
|
|
117126
117127
|
}
|
|
117127
|
-
|
|
117128
|
+
set2.status = 500;
|
|
117129
|
+
return {
|
|
117130
|
+
message: error48 instanceof Error ? error48.message : "Internal Server Error"
|
|
117131
|
+
};
|
|
117128
117132
|
});
|
|
117129
117133
|
if (options?.cors) {
|
|
117130
117134
|
AppStartup.elysia.use(cors(options.cors));
|
package/lib/app-startup.ts
CHANGED
package/lib/http-exceptions.ts
CHANGED
|
@@ -10,7 +10,12 @@ export class HttpException extends Error {
|
|
|
10
10
|
) {
|
|
11
11
|
const responseObj =
|
|
12
12
|
typeof response === "string" ? { message: response } : response;
|
|
13
|
-
|
|
13
|
+
const message =
|
|
14
|
+
typeof response === "string"
|
|
15
|
+
? response
|
|
16
|
+
: ((response as { message?: string }).message ??
|
|
17
|
+
JSON.stringify(response));
|
|
18
|
+
super(message);
|
|
14
19
|
this.response = responseObj;
|
|
15
20
|
Object.setPrototypeOf(this, HttpException.prototype);
|
|
16
21
|
}
|