@bragduck/cli 2.13.7 → 2.14.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/bin/bragduck.js +15 -9
- package/dist/bin/bragduck.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/bragduck.js
CHANGED
|
@@ -3316,33 +3316,39 @@ var JiraService = class {
|
|
|
3316
3316
|
if (!response.ok) {
|
|
3317
3317
|
const statusText = response.statusText;
|
|
3318
3318
|
const status = response.status;
|
|
3319
|
+
let responseBody = "";
|
|
3320
|
+
try {
|
|
3321
|
+
responseBody = await response.text();
|
|
3322
|
+
logger.debug(`Jira API error response (${status}): ${responseBody}`);
|
|
3323
|
+
} catch {
|
|
3324
|
+
}
|
|
3319
3325
|
if (status === 401) {
|
|
3320
3326
|
throw new JiraError("Invalid or expired API token", {
|
|
3321
3327
|
hint: "Run: bragduck auth atlassian",
|
|
3322
|
-
originalError: statusText
|
|
3328
|
+
originalError: responseBody || statusText
|
|
3323
3329
|
});
|
|
3324
3330
|
} else if (status === 403) {
|
|
3325
3331
|
throw new JiraError("Forbidden - check token permissions", {
|
|
3326
3332
|
hint: "Token needs: read access to issues",
|
|
3327
|
-
originalError: statusText
|
|
3333
|
+
originalError: responseBody || statusText
|
|
3328
3334
|
});
|
|
3329
3335
|
} else if (status === 404) {
|
|
3330
3336
|
throw new JiraError("Resource not found", {
|
|
3331
|
-
originalError: statusText
|
|
3337
|
+
originalError: responseBody || statusText
|
|
3332
3338
|
});
|
|
3333
3339
|
} else if (status === 410) {
|
|
3334
3340
|
throw new JiraError("Resource no longer available (deleted, archived, or moved)", {
|
|
3335
3341
|
hint: "The Jira issue, project, or instance may have been deleted/archived. Verify your instance URL and that the resource still exists.",
|
|
3336
|
-
originalError: statusText
|
|
3342
|
+
originalError: responseBody || statusText
|
|
3337
3343
|
});
|
|
3338
3344
|
} else if (status === 429) {
|
|
3339
3345
|
throw new JiraError("Rate limit exceeded", {
|
|
3340
3346
|
hint: "Wait a few minutes before trying again",
|
|
3341
|
-
originalError: statusText
|
|
3347
|
+
originalError: responseBody || statusText
|
|
3342
3348
|
});
|
|
3343
3349
|
}
|
|
3344
3350
|
throw new JiraError(`API request failed: ${statusText}`, {
|
|
3345
|
-
originalError: statusText
|
|
3351
|
+
originalError: responseBody || statusText
|
|
3346
3352
|
});
|
|
3347
3353
|
}
|
|
3348
3354
|
return response.json();
|
|
@@ -3352,7 +3358,7 @@ var JiraService = class {
|
|
|
3352
3358
|
*/
|
|
3353
3359
|
async validateJiraInstance() {
|
|
3354
3360
|
try {
|
|
3355
|
-
await this.request("/rest/api/
|
|
3361
|
+
await this.request("/rest/api/3/myself");
|
|
3356
3362
|
} catch (error) {
|
|
3357
3363
|
if (error instanceof JiraError) {
|
|
3358
3364
|
throw error;
|
|
@@ -3368,7 +3374,7 @@ var JiraService = class {
|
|
|
3368
3374
|
*/
|
|
3369
3375
|
async getCurrentUser() {
|
|
3370
3376
|
try {
|
|
3371
|
-
const user = await this.request("/rest/api/
|
|
3377
|
+
const user = await this.request("/rest/api/3/myself");
|
|
3372
3378
|
return user.accountId || user.name || user.emailAddress;
|
|
3373
3379
|
} catch {
|
|
3374
3380
|
return null;
|
|
@@ -3503,7 +3509,7 @@ var JiraService = class {
|
|
|
3503
3509
|
);
|
|
3504
3510
|
break;
|
|
3505
3511
|
}
|
|
3506
|
-
const endpoint = `/rest/api/
|
|
3512
|
+
const endpoint = `/rest/api/3/search?jql=${encodeURIComponent(jql)}&startAt=${startAt}&maxResults=${maxResults}&fields=${fields.join(",")}`;
|
|
3507
3513
|
try {
|
|
3508
3514
|
const response = await this.request(endpoint);
|
|
3509
3515
|
if (response.issues.length === 0) {
|