Skip to content

Commit b2d05be

Browse files
authored
fix: throw on jira request errors (#168)
1 parent c1e3889 commit b2d05be

File tree

4 files changed

+217
-130
lines changed

4 files changed

+217
-130
lines changed

.changeset/lemon-pears-repair.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@alauda/doom": patch
3+
---
4+
5+
fix: throw on jira request errors

packages/doom/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"dependencies": {
4343
"@alauda/doom-export": "^0.1.0",
4444
"@cspell/eslint-plugin": "^8.19.4 || ^9.2.0",
45-
"@eslint-react/eslint-plugin": "^1.52.7",
45+
"@eslint-react/eslint-plugin": "^1.52.9",
4646
"@inquirer/prompts": "^7.8.4",
4747
"@openapi-contrib/openapi-schema-to-json-schema": "^5.1.0",
4848
"@playwright/browser-chromium": "^1.55.0",
@@ -55,7 +55,7 @@
5555
"@rspress/plugin-llms": "2.0.0-beta.29",
5656
"@rspress/plugin-sitemap": "2.0.0-beta.29",
5757
"@rspress/shared": "2.0.0-beta.29",
58-
"@shikijs/transformers": "^3.12.0",
58+
"@shikijs/transformers": "^3.12.1",
5959
"@total-typescript/ts-reset": "^0.6.1",
6060
"ab64": "^0.1.6",
6161
"chokidar": "^4.0.3",
@@ -93,10 +93,10 @@
9393
"remark-lint-no-chinese-punctuation-in-number": "^0.1.2",
9494
"remark-lint-no-duplicate-headings-in-section": "^4.0.1",
9595
"remark-lint-no-hidden-table-cell": "^1.0.1",
96-
"remark-mdx": "^3.1.0",
96+
"remark-mdx": "^3.1.1",
9797
"remark-message-control": "^8.0.0",
9898
"remark-stringify": "^11.0.0",
99-
"shiki": "^3.12.0",
99+
"shiki": "^3.12.1",
100100
"simple-git": "^3.28.0",
101101
"string-width": "^7.2.0",
102102
"swagger2openapi": "^7.0.8",

packages/doom/src/plugins/replace/resolve-release.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { logger } from '@rspress/core'
2+
import { isProduction } from '@rspress/shared'
23
import { render } from 'ejs'
34
import type {
45
List,
@@ -11,7 +12,6 @@ import { ResponseError, xfetch } from 'x-fetch'
1112
import { cyan, red } from 'yoctocolors'
1213

1314
import type { JiraIssue, JiraLanguage } from './types.js'
14-
import { isCI } from './utils.js'
1515

1616
const releaseCache = new Map<
1717
string,
@@ -106,7 +106,7 @@ const resolveRelease_ = async (
106106
}
107107
warned = true
108108
const message = `\`${cyan('JIRA_USERNAME')}\` and \`${cyan('JIRA_PASSWORD')}\` environments must be set for fetching Jira issues`
109-
if (isCI) {
109+
if (isProduction()) {
110110
throw new Error(message)
111111
}
112112
logger.warn(message)
@@ -124,7 +124,9 @@ const resolveRelease_ = async (
124124

125125
const jql = await render(template, data, { async: true })
126126

127-
logger.info(`Fetching release notes for query \`${cyan(releaseQuery)}\``)
127+
logger.info(
128+
`Fetching release notes for query \`${cyan(releaseQuery)}\`, JQL: \`${cyan(jql)}\``,
129+
)
128130

129131
let issues: JiraIssue[]
130132

@@ -140,6 +142,9 @@ const resolveRelease_ = async (
140142
`Failed to fetch release notes for query \`${red(releaseQuery)}\` with status \`${error.response.status}\` and ${error.data ? `data ${JSON.stringify(error.data, null, 2)}` : `message \`${error.message}\``}`,
141143
)
142144
}
145+
if (isProduction()) {
146+
throw err
147+
}
143148
return
144149
}
145150

0 commit comments

Comments
 (0)