@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 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
- super(JSON.stringify(responseObj));
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
- return error48;
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));
@@ -142,7 +142,11 @@ export class AppStartup {
142
142
  };
143
143
  }
144
144
 
145
- return error;
145
+ set.status = 500;
146
+ return {
147
+ message:
148
+ error instanceof Error ? error.message : "Internal Server Error",
149
+ };
146
150
  });
147
151
 
148
152
  if (options?.cors) {
@@ -10,7 +10,12 @@ export class HttpException extends Error {
10
10
  ) {
11
11
  const responseObj =
12
12
  typeof response === "string" ? { message: response } : response;
13
- super(JSON.stringify(responseObj));
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
  }
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "types": "./dist/*.d.ts"
14
14
  }
15
15
  },
16
- "version": "0.3.10",
16
+ "version": "0.3.12",
17
17
  "homepage": "https://bunstone.diario.one/",
18
18
  "repository": {
19
19
  "url": "https://github.com/diariodaregiao/bunstone.git",