Better types for WebAPI
This commit is contained in:
@@ -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.
|
||||
|
Reference in New Issue
Block a user