mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-05 05:46:44 +00:00
fix error messages on subclassed importers/exporters
This commit is contained in:
parent
5482196cc7
commit
4d6609990c
8 changed files with 30 additions and 27 deletions
|
@ -57,8 +57,8 @@ public class CoboVaultSinglesig implements KeystoreFileImport, WalletImport {
|
||||||
|
|
||||||
return keystore;
|
return keystore;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error getting Cobo Vault keystore", e);
|
log.error("Error getting " + getName() + " keystore", e);
|
||||||
throw new ImportException("Error getting Cobo Vault keystore", e);
|
throw new ImportException("Error getting " + getName() + " keystore", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class CoboVaultSinglesig implements KeystoreFileImport, WalletImport {
|
||||||
try {
|
try {
|
||||||
wallet.checkWallet();
|
wallet.checkWallet();
|
||||||
} catch(InvalidWalletException e) {
|
} catch(InvalidWalletException e) {
|
||||||
throw new ImportException("Imported Cobo Vault wallet was invalid: " + e.getMessage());
|
throw new ImportException("Imported " + getName() + " wallet was invalid: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return wallet;
|
return wallet;
|
||||||
|
|
|
@ -150,8 +150,8 @@ public class ColdcardMultisig implements WalletImport, KeystoreFileImport, Walle
|
||||||
|
|
||||||
return wallet;
|
return wallet;
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
log.error("Error importing Coldcard multisig wallet", e);
|
log.error("Error importing " + getName() + " wallet", e);
|
||||||
throw new ImportException("Error importing Coldcard multisig wallet", e);
|
throw new ImportException("Error importing " + getName() + " wallet", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,8 +203,8 @@ public class ColdcardMultisig implements WalletImport, KeystoreFileImport, Walle
|
||||||
|
|
||||||
writer.flush();
|
writer.flush();
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
log.error("Error exporting Coldcard multisig wallet", e);
|
log.error("Error exporting " + getName() + " wallet", e);
|
||||||
throw new ExportException("Error exporting Coldcard multisig wallet", e);
|
throw new ExportException("Error exporting " + getName() + " wallet", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,8 +86,8 @@ public class ColdcardSinglesig implements KeystoreFileImport, WalletImport {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error getting Coldcard keystore", e);
|
log.error("Error getting " + getName() + " keystore", e);
|
||||||
throw new ImportException("Error getting Coldcard keystore", e);
|
throw new ImportException("Error getting " + getName() + " keystore", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ImportException("Correct derivation not found for script type: " + scriptType);
|
throw new ImportException("Correct derivation not found for script type: " + scriptType);
|
||||||
|
|
|
@ -62,11 +62,11 @@ public class KeystoneSinglesig implements KeystoreFileImport, WalletImport {
|
||||||
|
|
||||||
return keystore;
|
return keystore;
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
log.error("Error getting Keystone keystore - not an output descriptor");
|
log.error("Error getting " + getName() + " keystore - not an output descriptor");
|
||||||
throw new ImportException("Error getting Keystone keystore", e);
|
throw new ImportException("Error getting " + getName() + " keystore", e);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Error getting Keystone keystore", e);
|
log.error("Error getting " + getName() + " keystore", e);
|
||||||
throw new ImportException("Error getting Keystone keystore", e);
|
throw new ImportException("Error getting " + getName() + " keystore", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ public class KeystoneSinglesig implements KeystoreFileImport, WalletImport {
|
||||||
try {
|
try {
|
||||||
wallet.checkWallet();
|
wallet.checkWallet();
|
||||||
} catch(InvalidWalletException e) {
|
} catch(InvalidWalletException e) {
|
||||||
throw new ImportException("Imported Keystone wallet was invalid: " + e.getMessage());
|
throw new ImportException("Imported " + getName() + " wallet was invalid: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return wallet;
|
return wallet;
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class Sparrow implements WalletImport, WalletExport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getWalletExportDescription() {
|
public String getWalletExportDescription() {
|
||||||
return "Exports your Sparrow wallet file, which can be imported into another Sparrow instance running on any supported platform.";
|
return "Exports your Sparrow wallet file, which can be imported into another Sparrow instance running on any supported platform. If the wallet is encrypted, the same password is used to encrypt the exported file.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,8 +35,8 @@ public class SpecterDIY implements KeystoreFileImport, WalletExport {
|
||||||
|
|
||||||
return keystore;
|
return keystore;
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
log.error("Error getting Specter DIY keystore", e);
|
log.error("Error getting " + getName() + " keystore", e);
|
||||||
throw new ImportException("Error getting Specter DIY keystore", e);
|
throw new ImportException("Error getting " + getName() + " keystore", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,8 +72,8 @@ public class SpecterDIY implements KeystoreFileImport, WalletExport {
|
||||||
writer.append("addwallet ").append(wallet.getName()).append("&").append(OutputDescriptor.getOutputDescriptor(wallet).toString().replace('\'', 'h')).append("\n");
|
writer.append("addwallet ").append(wallet.getName()).append("&").append(OutputDescriptor.getOutputDescriptor(wallet).toString().replace('\'', 'h')).append("\n");
|
||||||
writer.flush();
|
writer.flush();
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
log.error("Error exporting Specter DIY wallet", e);
|
log.error("Error exporting " + getName() + " wallet", e);
|
||||||
throw new ExportException("Error exporting Specter DIY wallet", e);
|
throw new ExportException("Error exporting " + getName() + " wallet", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,8 @@ public class SpecterDesktop implements WalletImport, WalletExport {
|
||||||
outputStream.write(json.getBytes(StandardCharsets.UTF_8));
|
outputStream.write(json.getBytes(StandardCharsets.UTF_8));
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
log.error("Error exporting Specter Desktop wallet", e);
|
log.error("Error exporting " + getName() + " wallet", e);
|
||||||
throw new ExportException("Error exporting Specter Desktop wallet", e);
|
throw new ExportException("Error exporting " + getName() + " wallet", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,17 +87,17 @@ public class SpecterDesktop implements WalletImport, WalletExport {
|
||||||
try {
|
try {
|
||||||
wallet.checkWallet();
|
wallet.checkWallet();
|
||||||
} catch(InvalidWalletException e) {
|
} catch(InvalidWalletException e) {
|
||||||
throw new ImportException("Imported Specter wallet was invalid: " + e.getMessage());
|
throw new ImportException("Imported " + getName() + " wallet was invalid: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return wallet;
|
return wallet;
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
log.error("Error importing Specter Desktop wallet", e);
|
log.error("Error importing " + getName() + " wallet", e);
|
||||||
throw new ImportException("Error importing Specter Desktop wallet", e);
|
throw new ImportException("Error importing " + getName() + " wallet", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ImportException("File was not a valid Specter Desktop wallet");
|
throw new ImportException("File was not a valid " + getName() + " wallet");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -161,8 +161,11 @@ public class TransactionsController extends WalletFormController implements Init
|
||||||
String date = LOG_DATE_FORMAT.format(new Date());
|
String date = LOG_DATE_FORMAT.format(new Date());
|
||||||
String logLine = "\n" + date + " " + logMessage;
|
String logLine = "\n" + date + " " + logMessage;
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
|
int lastLineStart = loadingLog.getText().lastIndexOf("\n");
|
||||||
|
if(lastLineStart < 0 || !loadingLog.getText().substring(lastLineStart).equals(logLine)) {
|
||||||
loadingLog.appendText(logLine);
|
loadingLog.appendText(logLine);
|
||||||
loadingLog.setScrollLeft(0);
|
loadingLog.setScrollLeft(0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue