mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-19 05:33:31 +01:00
Improve error message for create store wallet transaction (Fix #3256)
This commit is contained in:
parent
e957180618
commit
03af471f65
@ -23,7 +23,7 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
|
||||
if (!_walletProvider.IsAvailable(network))
|
||||
{
|
||||
return this.CreateAPIError("not-available",
|
||||
return this.CreateAPIError(503, "not-available",
|
||||
$"{cryptoCode} services are not currently available");
|
||||
}
|
||||
|
||||
@ -59,13 +59,13 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
response = await client.GenerateWalletAsync(request);
|
||||
if (response == null)
|
||||
{
|
||||
return this.CreateAPIError("not-available",
|
||||
return this.CreateAPIError(503, "not-available",
|
||||
$"{cryptoCode} services are not currently available");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return this.CreateAPIError("not-available",
|
||||
return this.CreateAPIError(503, "not-available",
|
||||
$"{cryptoCode} error: {e.Message}");
|
||||
}
|
||||
|
||||
|
@ -271,14 +271,14 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
return actionResult;
|
||||
if (network.ReadonlyWallet)
|
||||
{
|
||||
return this.CreateAPIError("not-available",
|
||||
return this.CreateAPIError(503, "not-available",
|
||||
$"{cryptoCode} sending services are not currently available");
|
||||
}
|
||||
|
||||
//This API is only meant for hot wallet usage for now. We can expand later when we allow PSBT manipulation.
|
||||
if (!(await CanUseHotWallet()).HotWallet)
|
||||
{
|
||||
return Unauthorized();
|
||||
return this.CreateAPIError(503, "not-available", $"You need to allow non-admins to use hotwallets for their stores (in /server/policies)");
|
||||
}
|
||||
|
||||
var explorerClient = _explorerClientProvider.GetExplorerClient(cryptoCode);
|
||||
@ -425,7 +425,7 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
return this.CreateAPIError("not-available", "You need to update your version of NBXplorer");
|
||||
return this.CreateAPIError(503, "not-available", "You need to update your version of NBXplorer");
|
||||
}
|
||||
|
||||
derivationScheme.RebaseKeyPaths(psbt.PSBT);
|
||||
@ -445,7 +445,7 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
WellknownMetadataKeys.MasterHDKey);
|
||||
if (!derivationScheme.IsHotWallet || signingKeyStr is null)
|
||||
{
|
||||
return this.CreateAPIError("not-available",
|
||||
return this.CreateAPIError(503, "not-available",
|
||||
$"{cryptoCode} sending services are not currently available");
|
||||
}
|
||||
|
||||
@ -538,7 +538,7 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
|
||||
if (!network.WalletSupported || !_btcPayWalletProvider.IsAvailable(network))
|
||||
{
|
||||
actionResult = this.CreateAPIError("not-available",
|
||||
actionResult = this.CreateAPIError(503, "not-available",
|
||||
$"{cryptoCode} services are not currently available");
|
||||
return true;
|
||||
}
|
||||
@ -546,7 +546,7 @@ namespace BTCPayServer.Controllers.GreenField
|
||||
derivationScheme = GetDerivationSchemeSettings(cryptoCode);
|
||||
if (derivationScheme?.AccountDerivation is null)
|
||||
{
|
||||
actionResult = this.CreateAPIError("not-available",
|
||||
actionResult = this.CreateAPIError(503, "not-available",
|
||||
$"{cryptoCode} doesn't have any derivation scheme set");
|
||||
return true;
|
||||
}
|
||||
|
@ -317,6 +317,9 @@
|
||||
},
|
||||
"404": {
|
||||
"description": "The key is not found for this store/wallet"
|
||||
},
|
||||
"503": {
|
||||
"description": "You need to allow non-admins to use hotwallets for their stores (in /server/policies)"
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
|
Loading…
Reference in New Issue
Block a user