Remove useless try/catch

This commit is contained in:
nicolas.dorier 2019-11-22 19:16:32 +09:00
parent 1aa4dbb90d
commit 98276bcb3d
No known key found for this signature in database
GPG key ID: 6618763EF09186FE

View file

@ -110,22 +110,9 @@ namespace BTCPayServer.Controllers
continue;
}
if (fingerprint is null)
{
try
{
fingerprint = (await device.GetXPubAsync(new KeyPath("44'"), cancellationToken)).ExtPubKey.ParentFingerprint;
}
catch (Hwi.HwiException ex) when (ex.ErrorCode == Hwi.HwiErrorCode.DeviceNotReady)
{
await websocketHelper.Send("{ \"error\": \"need-pin\"}", cancellationToken);
continue;
}
catch (Hwi.HwiException ex) when (ex.ErrorCode == Hwi.HwiErrorCode.NoPassword)
{
await websocketHelper.Send("{ \"error\": \"need-passphrase\"}", cancellationToken);
continue;
}
}
await websocketHelper.Send("{ \"info\": \"ready\"}", cancellationToken);
o = JObject.Parse(await websocketHelper.NextMessageAsync(cancellationToken));
var authorization = await _authorizationService.AuthorizeAsync(User, Policies.CanModifyStoreSettings.Key);
@ -147,16 +134,6 @@ namespace BTCPayServer.Controllers
{
psbt = await device.SignPSBTAsync(psbt, cancellationToken);
}
catch (Hwi.HwiException ex) when (ex.ErrorCode == Hwi.HwiErrorCode.DeviceNotReady)
{
await websocketHelper.Send("{ \"error\": \"need-pin\"}", cancellationToken);
continue;
}
catch (Hwi.HwiException ex) when (ex.ErrorCode == Hwi.HwiErrorCode.NoPassword)
{
await websocketHelper.Send("{ \"error\": \"need-passphrase\"}", cancellationToken);
continue;
}
catch (Hwi.HwiException)
{
await websocketHelper.Send("{ \"error\": \"user-reject\"}", cancellationToken);
@ -198,21 +175,7 @@ namespace BTCPayServer.Controllers
JObject result = new JObject();
var factory = network.NBXplorerNetwork.DerivationStrategyFactory;
var keyPath = new KeyPath("84'").Derive(network.CoinType).Derive(0, true);
BitcoinExtPubKey xpub = null;
try
{
xpub = await device.GetXPubAsync(keyPath);
}
catch (Hwi.HwiException ex) when (ex.ErrorCode == Hwi.HwiErrorCode.DeviceNotReady)
{
await websocketHelper.Send("{ \"error\": \"need-pin\"}", cancellationToken);
continue;
}
catch (Hwi.HwiException ex) when (ex.ErrorCode == Hwi.HwiErrorCode.NoPassword)
{
await websocketHelper.Send("{ \"error\": \"need-passphrase\"}", cancellationToken);
continue;
}
BitcoinExtPubKey xpub = await device.GetXPubAsync(keyPath);
if (fingerprint is null)
{
fingerprint = (await device.GetXPubAsync(new KeyPath("44'"), cancellationToken)).ExtPubKey.ParentFingerprint;