Skip to content

Commit 1c4ea8f

Browse files
author
Bart Veneman
committed
ditch statusText
1 parent 6c4d289 commit 1c4ea8f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

api/v2/_extract-css-basic.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ export function getStyles(nodes) {
8181
}
8282

8383
export class HttpError extends Error {
84-
constructor({ url, statusCode, statusText }) {
84+
constructor({ url, statusCode, originalMessage }) {
8585
super()
8686
this.url = url
87-
this.statusCode = statusCode
88-
this.statusText = statusText
89-
this.message = `The origin server at "${url}" errored with status ${statusCode} (${statusText})`
87+
this.statusCode = statusCode === 'ENOTFOUND' ? 404 : 500
88+
this.message = `The origin server at "${url}" errored with statusCode ${statusCode}`
89+
this.originalMessage = originalMessage
9090
}
9191
}
9292

@@ -100,7 +100,7 @@ export async function extractCss(url) {
100100
headers = response.headers
101101
} catch (error) {
102102
console.error(error)
103-
throw new HttpError({ url, statusCode: error.code, statusText: error.message })
103+
throw new HttpError({ url, statusCode: error.code, originalMessage: error.message })
104104
}
105105

106106
// Return early if our response was a CSS file already

0 commit comments

Comments
 (0)