Skip to content

Commit 0fdd082

Browse files
committed
inline error
1 parent 4c6e919 commit 0fdd082

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/lib/util/utils.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,19 +148,18 @@ export type Options = {
148148
export async function makeRequest(options: Options) {
149149
const response = await fetch(options.url)
150150
const responseBody = await response.text()
151-
151+
152152
if (options.errorOnNon200Response && response.status !== 200) {
153153
throw new Error(`StatusCode: "${response.status}", ResponseBody: "${responseBody}."`)
154154
}
155-
155+
156156
let res = responseBody
157157
try {
158158
if (typeof responseBody.valueOf() === "string") {
159159
res = parseContent(options.url, responseBody)
160160
}
161161
} catch (error) {
162-
const msg = `An error occurred while parsing the file ${options.url}. The error is:\n ${util.inspect(error, { depth: null })}.`
163-
throw new Error(msg)
162+
throw new Error(`An error occurred while parsing the file ${options.url}. The error is:\n ${util.inspect(error, { depth: null })}.`)
164163
}
165164

166165
return res

0 commit comments

Comments
 (0)