@restura/core 1.0.17 → 1.0.19

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.d.ts CHANGED
@@ -19,12 +19,12 @@ declare const loggerConfigSchema: z.ZodObject<{
19
19
  }, z.core.$strip>;
20
20
  type LoggerConfigSchema = z.infer<typeof loggerConfigSchema>;
21
21
 
22
- interface RsErrorInternalData {
22
+ interface RsErrorInternalData<T extends Record<string, unknown> = Record<string, unknown>> {
23
23
  err: ErrorCode;
24
24
  msg: string;
25
25
  stack: string;
26
26
  status: number;
27
- message?: string;
27
+ options?: T;
28
28
  }
29
29
  declare enum HtmlStatusCodes {
30
30
  BAD_REQUEST = 400,
@@ -49,12 +49,13 @@ declare enum HtmlStatusCodes {
49
49
  NETWORK_CONNECT_TIMEOUT = 599
50
50
  }
51
51
  type ErrorCode = 'BAD_REQUEST' | 'UNAUTHORIZED' | 'PAYMENT_REQUIRED' | 'FORBIDDEN' | 'NOT_FOUND' | 'METHOD_NOT_ALLOWED' | 'REQUEST_TIMEOUT' | 'CONFLICT' | 'GONE' | 'PAYLOAD_TOO_LARGE' | 'UNSUPPORTED_MEDIA_TYPE' | 'UPGRADE_REQUIRED' | 'UNPROCESSABLE_ENTITY' | 'TOO_MANY_REQUESTS' | 'SERVER_ERROR' | 'NOT_IMPLEMENTED' | 'BAD_GATEWAY' | 'SERVICE_UNAVAILABLE' | 'GATEWAY_TIMEOUT' | 'NETWORK_CONNECT_TIMEOUT' | 'UNKNOWN_ERROR' | 'RATE_LIMIT_EXCEEDED' | 'INVALID_TOKEN' | 'INCORRECT_EMAIL_OR_PASSWORD' | 'DUPLICATE' | 'CONNECTION_ERROR' | 'SCHEMA_ERROR' | 'DATABASE_ERROR';
52
- declare class RsError {
52
+ declare class RsError<T extends Record<string, unknown> = Record<string, unknown>> {
53
53
  err: ErrorCode;
54
54
  msg: string;
55
+ options?: T;
55
56
  status?: number;
56
57
  stack: string;
57
- constructor(errCode: ErrorCode, message?: string);
58
+ constructor(errCode: ErrorCode, message?: string, options?: T);
58
59
  static htmlStatus(code: ErrorCode): number;
59
60
  static isRsError(error: unknown): error is RsError;
60
61
  }
package/dist/index.js CHANGED
@@ -233,13 +233,15 @@ var HtmlStatusCodes = /* @__PURE__ */ ((HtmlStatusCodes2) => {
233
233
  var RsError = class _RsError {
234
234
  err;
235
235
  msg;
236
+ options;
236
237
  status;
237
238
  stack;
238
- constructor(errCode, message) {
239
+ constructor(errCode, message, options) {
239
240
  this.err = errCode;
240
241
  this.msg = message || "";
241
242
  this.status = _RsError.htmlStatus(errCode);
242
243
  this.stack = new Error().stack || "";
244
+ this.options = options;
243
245
  }
244
246
  static htmlStatus(code) {
245
247
  return htmlStatusMap[code];