Skip to content

Commit 826afcd

Browse files
authored
Merge pull request #6956 from BitGo/coin-5426-throw-error-on-failure
fix: don't catch the exception thrown form sign or build methods
2 parents d8da40d + 96d8c40 commit 826afcd

File tree

1 file changed

+23
-28
lines changed

1 file changed

+23
-28
lines changed

modules/sdk-core/src/bitgo/walletUtil/signAccountBasedMidnightClaimMessages.ts

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,35 +47,30 @@ async function signOrBuildMessage(
4747
messageStandardType: MessageStandardType,
4848
walletPassphrase?: string
4949
): Promise<{ success: boolean; address: string; txRequestId?: string }> {
50-
try {
51-
let txRequestId: string;
52-
if (walletPassphrase !== undefined) {
53-
// Sign the messages with the wallet
54-
const signedMessage = await wallet.signMessage({
55-
message: {
56-
messageRaw: messageInfo.message,
57-
messageStandardType,
58-
signerAddress: messageInfo.address,
59-
},
60-
walletPassphrase,
61-
});
62-
txRequestId = signedMessage.txRequestId;
63-
} else {
64-
// Build the sign message request
65-
const txRequest = await wallet.buildSignMessageRequest({
66-
message: {
67-
messageRaw: messageInfo.message,
68-
messageStandardType,
69-
signerAddress: messageInfo.address,
70-
},
71-
});
72-
txRequestId = txRequest.txRequestId;
73-
}
74-
return { success: true, address: messageInfo.address, txRequestId };
75-
} catch (e) {
76-
console.error(`Error building/signing message for address ${messageInfo.address}: ${e}`);
77-
return { success: false, address: messageInfo.address };
50+
let txRequestId: string;
51+
if (walletPassphrase !== undefined) {
52+
// Sign the messages with the wallet
53+
const signedMessage = await wallet.signMessage({
54+
message: {
55+
messageRaw: messageInfo.message,
56+
messageStandardType,
57+
signerAddress: messageInfo.address,
58+
},
59+
walletPassphrase,
60+
});
61+
txRequestId = signedMessage.txRequestId;
62+
} else {
63+
// Build the sign message request
64+
const txRequest = await wallet.buildSignMessageRequest({
65+
message: {
66+
messageRaw: messageInfo.message,
67+
messageStandardType,
68+
signerAddress: messageInfo.address,
69+
},
70+
});
71+
txRequestId = txRequest.txRequestId;
7872
}
73+
return { success: true, address: messageInfo.address, txRequestId };
7974
}
8075

8176
function processResults(

0 commit comments

Comments
 (0)