@supernova-studio/client 0.54.35 → 0.55.0

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.mts CHANGED
@@ -47827,7 +47827,9 @@ type RequestEexecutorServerErrorCode = SupernovaExceptionType | undefined;
47827
47827
  declare class RequestExecutorError extends Error {
47828
47828
  readonly type: RequestExecutorErrorType;
47829
47829
  readonly errorCode: RequestEexecutorServerErrorCode;
47830
+ readonly serverErrorType: SupernovaExceptionType | undefined;
47830
47831
  static tryParseErrorCode(body: string): any;
47832
+ static tryParseServerErrorType(body: string): any;
47831
47833
  static serverError(endpoint: string, status: number, bodyText: string): RequestExecutorError;
47832
47834
  static responseParsingError(endpoint: string, cause: Error): RequestExecutorError;
47833
47835
  private constructor();
package/dist/index.d.ts CHANGED
@@ -47827,7 +47827,9 @@ type RequestEexecutorServerErrorCode = SupernovaExceptionType | undefined;
47827
47827
  declare class RequestExecutorError extends Error {
47828
47828
  readonly type: RequestExecutorErrorType;
47829
47829
  readonly errorCode: RequestEexecutorServerErrorCode;
47830
+ readonly serverErrorType: SupernovaExceptionType | undefined;
47830
47831
  static tryParseErrorCode(body: string): any;
47832
+ static tryParseServerErrorType(body: string): any;
47831
47833
  static serverError(endpoint: string, status: number, bodyText: string): RequestExecutorError;
47832
47834
  static responseParsingError(endpoint: string, cause: Error): RequestExecutorError;
47833
47835
  private constructor();
package/dist/index.js CHANGED
@@ -6604,12 +6604,14 @@ var WorkspacesEndpoint = class {
6604
6604
 
6605
6605
  // src/api/transport/request-executor-error.ts
6606
6606
  var RequestExecutorError = class _RequestExecutorError extends Error {
6607
- constructor(type, message, errorCode, cause) {
6607
+ constructor(type, message, errorCode, serverErrorType, cause) {
6608
6608
  super(`${type}: ${message}`, { cause });
6609
6609
  __publicField(this, "type");
6610
6610
  __publicField(this, "errorCode");
6611
+ __publicField(this, "serverErrorType");
6611
6612
  this.type = type;
6612
6613
  this.errorCode = errorCode;
6614
+ this.serverErrorType = serverErrorType;
6613
6615
  }
6614
6616
  static tryParseErrorCode(body) {
6615
6617
  try {
@@ -6622,12 +6624,24 @@ var RequestExecutorError = class _RequestExecutorError extends Error {
6622
6624
  return null;
6623
6625
  }
6624
6626
  }
6627
+ static tryParseServerErrorType(body) {
6628
+ try {
6629
+ const errorObj = JSON.parse(body);
6630
+ if (errorObj && typeof errorObj.errorCode === "string") {
6631
+ return errorObj.type;
6632
+ }
6633
+ return null;
6634
+ } catch (e) {
6635
+ return null;
6636
+ }
6637
+ }
6625
6638
  static serverError(endpoint, status, bodyText) {
6626
6639
  return new _RequestExecutorError(
6627
6640
  "ServerError",
6628
6641
  `Endpoint ${endpoint} returned ${status}
6629
6642
  ${bodyText}`,
6630
- this.tryParseErrorCode(bodyText)
6643
+ this.tryParseErrorCode(bodyText),
6644
+ this.tryParseServerErrorType(bodyText)
6631
6645
  );
6632
6646
  }
6633
6647
  static responseParsingError(endpoint, cause) {
@@ -6635,6 +6649,7 @@ ${bodyText}`,
6635
6649
  "ResponseParsingError",
6636
6650
  `Endpoint ${endpoint} returned incompatible JSON`,
6637
6651
  void 0,
6652
+ void 0,
6638
6653
  cause
6639
6654
  );
6640
6655
  }