@supernova-studio/client 1.69.6 → 1.69.7

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.mjs CHANGED
@@ -5823,7 +5823,8 @@ var FlaggedFeature = z208.enum([
5823
5823
  "ForgeOnDemandIterations",
5824
5824
  "ForgeAutoRetryOnErrors",
5825
5825
  "ForgeAiBackendMigrated",
5826
- "CustomForgeTemplate"
5826
+ "CustomForgeTemplate",
5827
+ "ForgeRestartPlaywright"
5827
5828
  ]);
5828
5829
  var FeatureFlagMap = z208.record(FlaggedFeature, z208.boolean());
5829
5830
  var FeatureFlag = z208.object({
@@ -13519,35 +13520,22 @@ var RequestExecutorError = class _RequestExecutorError extends Error {
13519
13520
  this.errorCode = errorCode;
13520
13521
  this.serverErrorType = serverErrorType;
13521
13522
  }
13522
- static tryParseErrorCode(body) {
13523
+ static tryParseJSON(body) {
13523
13524
  try {
13524
- const errorObj = JSON.parse(body);
13525
- if (errorObj && typeof errorObj.errorCode === "string") {
13526
- return errorObj.errorCode;
13527
- }
13528
- return null;
13529
- } catch (e) {
13530
- return null;
13531
- }
13532
- }
13533
- static tryParseServerErrorType(body) {
13534
- try {
13535
- const errorObj = JSON.parse(body);
13536
- if (errorObj && typeof errorObj.errorCode === "string") {
13537
- return errorObj.type;
13538
- }
13539
- return null;
13525
+ return JSON.parse(body);
13540
13526
  } catch (e) {
13541
13527
  return null;
13542
13528
  }
13543
13529
  }
13544
13530
  static serverError(endpoint, status, bodyText) {
13531
+ const parsedBody = this.tryParseJSON(bodyText);
13545
13532
  return new _RequestExecutorError(
13546
13533
  "ServerError",
13547
13534
  `Endpoint ${endpoint} returned ${status}
13548
13535
  ${bodyText}`,
13549
- this.tryParseErrorCode(bodyText),
13550
- this.tryParseServerErrorType(bodyText)
13536
+ parsedBody?.errorCode ?? null,
13537
+ parsedBody?.type ?? null,
13538
+ parsedBody ?? null
13551
13539
  );
13552
13540
  }
13553
13541
  static responseParsingError(endpoint, cause) {
@@ -13559,6 +13547,12 @@ ${bodyText}`,
13559
13547
  cause
13560
13548
  );
13561
13549
  }
13550
+ getDisplayMessage() {
13551
+ if (this.type === "ServerError" && this.cause && typeof this.cause === "object" && "message" in this.cause) {
13552
+ return this.cause.message || this.message;
13553
+ }
13554
+ return this.message;
13555
+ }
13562
13556
  };
13563
13557
 
13564
13558
  // src/api/transport/request-executor.ts