Better types for WebAPI
This commit is contained in:
parent
c05d23e628
commit
b9d6497cb1
22 changed files with 156 additions and 107 deletions
|
@ -2,6 +2,7 @@
|
|||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import * as log from '../logging/log';
|
||||
import { HTTPError } from './Errors';
|
||||
|
||||
export async function handleStatusCode(status: number): Promise<void> {
|
||||
if (status === 499) {
|
||||
|
@ -11,7 +12,7 @@ export async function handleStatusCode(status: number): Promise<void> {
|
|||
}
|
||||
}
|
||||
|
||||
export function translateError(error: Error): Error | undefined {
|
||||
export function translateError(error: HTTPError): HTTPError | undefined {
|
||||
const { code } = error;
|
||||
if (code === 200) {
|
||||
// Happens sometimes when we get no response. Might be nice to get 204 instead.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue