fix: wire response + init error handling

This commit is contained in:
liyasthomas
2021-07-15 09:40:45 +05:30
parent 86c9e09782
commit 3ef8e677c7
16 changed files with 283 additions and 152 deletions

View File

@@ -1,14 +1,25 @@
import { HoppRESTRequest } from "./HoppRESTRequest"
export type HoppRESTResponse =
| { type: "loading" }
| { type: "loading"; req: HoppRESTRequest }
| {
type: "fail"
headers: { key: string; value: string }[]
body: ArrayBuffer
statusCode: number
meta: {
responseSize: number // in bytes
responseDuration: number // in millis
}
req: HoppRESTRequest
}
| {
type: "network_fail"
error: Error
req: HoppRESTRequest
}
| {
type: "success"
@@ -19,4 +30,6 @@ export type HoppRESTResponse =
responseSize: number // in bytes
responseDuration: number // in millis
}
req: HoppRESTRequest
}