@earthlink/dotvault 0.14.2 → 0.14.3

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
@@ -61,14 +61,18 @@ var InvalidCredentialsError = class extends EnvSyncError {
61
61
  }
62
62
  };
63
63
  var PermissionDeniedError = class extends EnvSyncError {
64
- constructor(project, env) {
65
- super("PERMISSION_DENIED", `You do not have permission for project '${project}' env '${env}'. Ask an org admin to grant access at https://app.dotvault.io.`, 4);
64
+ constructor(project, env, serverMessage) {
65
+ const scope = project !== void 0 && env !== void 0 ? ` for project '${project}' env '${env}'` : "";
66
+ const detail = serverMessage !== void 0 && serverMessage.length > 0 ? ` (server: ${serverMessage})` : "";
67
+ super("PERMISSION_DENIED", `You do not have permission${scope}${detail}. Ask an org admin to grant access at https://app.dotvault.io.`, 4);
66
68
  this.name = "PermissionDeniedError";
67
69
  }
68
70
  };
69
71
  var ProjectNotFoundError = class extends EnvSyncError {
70
- constructor(project, env) {
71
- super("PROJECT_NOT_FOUND", `No secrets found for project '${project}' env '${env}'. Check the names \u2014 they are case-sensitive \u2014 and that the project exists in the admin console.`, 5);
72
+ constructor(project, env, serverMessage) {
73
+ const scope = project !== void 0 && env !== void 0 ? ` for project '${project}' env '${env}'` : "";
74
+ const detail = serverMessage !== void 0 && serverMessage.length > 0 ? ` (server: ${serverMessage})` : "";
75
+ super("PROJECT_NOT_FOUND", `No secrets found${scope}${detail}. Check the names \u2014 they are case-sensitive \u2014 and that the project exists in the admin console.`, 5);
72
76
  this.name = "ProjectNotFoundError";
73
77
  }
74
78
  };
@@ -607,16 +611,10 @@ async function handleResponse(res, ctx) {
607
611
  throw new AuthRequiredError(message);
608
612
  }
609
613
  if (res.status === 403) {
610
- throw new PermissionDeniedError(
611
- ctx?.project ?? "(unknown project)",
612
- ctx?.env ?? "(unknown env)"
613
- );
614
+ throw new PermissionDeniedError(ctx?.project, ctx?.env, parsed?.message);
614
615
  }
615
616
  if (res.status === 404) {
616
- throw new ProjectNotFoundError(
617
- ctx?.project ?? "(unknown project)",
618
- ctx?.env ?? "(unknown env)"
619
- );
617
+ throw new ProjectNotFoundError(ctx?.project, ctx?.env, parsed?.message);
620
618
  }
621
619
  throw new EnvSyncError(code, message, 99);
622
620
  }