Skip to content

Commit

Permalink
keyring-controller: throw explicit error on undefined result from nor…
Browse files Browse the repository at this point in the history
…malizeAddress
  • Loading branch information
legobeat committed May 2, 2023
1 parent f6850f3 commit 4705ae4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/keyring-controller/src/KeyringController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ export class KeyringController extends BaseController<
) {
try {
const address = normalizeAddress(messageParams.from);
if (!address?.length) {
throw new Error(
`Missing or invalid address ${JSON.stringify(messageParams.from)}`,
);
}
const qrKeyring = await this.getOrAddQRKeyring();
const qrAccounts = await qrKeyring.getAccounts();
if (
Expand Down Expand Up @@ -719,6 +724,8 @@ export class KeyringController extends BaseController<
};
});
} catch (e) {
// TODO: Add test case for when keyring throws
/* istanbul ignore next */
throw new Error(`Unspecified error when connect QR Hardware, ${e}`);
}
}
Expand Down

0 comments on commit 4705ae4

Please sign in to comment.