Better types for WebAPI

This commit is contained in:
Fedor Indutny 2021-09-21 17:58:03 -07:00 committed by GitHub
parent c05d23e628
commit b9d6497cb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 156 additions and 107 deletions

View file

@ -8,7 +8,7 @@ import {
PublicKey,
} from '@signalapp/signal-client';
import { UnregisteredUserError } from './Errors';
import { UnregisteredUserError, HTTPError } from './Errors';
import { Sessions, IdentityKeys } from '../LibSignalStores';
import { Address } from '../types/Address';
import { QualifiedAddress } from '../types/QualifiedAddress';
@ -35,7 +35,7 @@ export async function getKeysForIdentifier(
accessKeyFailed,
};
} catch (error) {
if (error.name === 'HTTPError' && error.code === 404) {
if (error instanceof HTTPError && error.code === 404) {
const theirUuid = UUID.lookup(identifier);
if (theirUuid) {