mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Avoid class properties shorthand in FetchError constructor (#8002)
GitOrigin-RevId: e210fc7d8104a8e4240efc8d0192aceafe07af61
This commit is contained in:
parent
713fe8946b
commit
0c1ff5bccf
1 changed files with 15 additions and 4 deletions
|
@ -48,12 +48,17 @@ function getErrorMessageForStatusCode(statusCode?: number) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class FetchError extends OError {
|
export class FetchError extends OError {
|
||||||
|
public url: string
|
||||||
|
public options?: RequestInit
|
||||||
|
public response?: Response
|
||||||
|
public data?: any
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
message: string,
|
message: string,
|
||||||
public url: string,
|
url: string,
|
||||||
public options?: RequestInit,
|
options?: RequestInit,
|
||||||
public response?: Response,
|
response?: Response,
|
||||||
public data?: any
|
data?: any
|
||||||
) {
|
) {
|
||||||
// On HTTP2, the `statusText` property is not set,
|
// On HTTP2, the `statusText` property is not set,
|
||||||
// so this `message` will be undefined. We need to
|
// so this `message` will be undefined. We need to
|
||||||
|
@ -62,7 +67,13 @@ export class FetchError extends OError {
|
||||||
if (!message) {
|
if (!message) {
|
||||||
message = getErrorMessageForStatusCode(response?.status)
|
message = getErrorMessageForStatusCode(response?.status)
|
||||||
}
|
}
|
||||||
|
|
||||||
super(message, { statusCode: response ? response.status : undefined })
|
super(message, { statusCode: response ? response.status : undefined })
|
||||||
|
|
||||||
|
this.url = url
|
||||||
|
this.options = options
|
||||||
|
this.response = response
|
||||||
|
this.data = data
|
||||||
}
|
}
|
||||||
|
|
||||||
getUserFacingMessage() {
|
getUserFacingMessage() {
|
||||||
|
|
Loading…
Reference in a new issue