Browse Source

fix error messages on subclassed importers/exporters

terminal
Craig Raw 4 years ago
parent
commit
4d6609990c
  1. 6
      src/main/java/com/sparrowwallet/sparrow/io/CoboVaultSinglesig.java
  2. 8
      src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java
  3. 4
      src/main/java/com/sparrowwallet/sparrow/io/ColdcardSinglesig.java
  4. 10
      src/main/java/com/sparrowwallet/sparrow/io/KeystoneSinglesig.java
  5. 2
      src/main/java/com/sparrowwallet/sparrow/io/Sparrow.java
  6. 8
      src/main/java/com/sparrowwallet/sparrow/io/SpecterDIY.java
  7. 12
      src/main/java/com/sparrowwallet/sparrow/io/SpecterDesktop.java
  8. 7
      src/main/java/com/sparrowwallet/sparrow/wallet/TransactionsController.java

6
src/main/java/com/sparrowwallet/sparrow/io/CoboVaultSinglesig.java

@ -57,8 +57,8 @@ public class CoboVaultSinglesig implements KeystoreFileImport, WalletImport {
return keystore;
} catch (Exception e) {
log.error("Error getting Cobo Vault keystore", e);
throw new ImportException("Error getting Cobo Vault keystore", e);
log.error("Error getting " + getName() + " keystore", e);
throw new ImportException("Error getting " + getName() + " keystore", e);
}
}
@ -81,7 +81,7 @@ public class CoboVaultSinglesig implements KeystoreFileImport, WalletImport {
try {
wallet.checkWallet();
} 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;

8
src/main/java/com/sparrowwallet/sparrow/io/ColdcardMultisig.java

@ -150,8 +150,8 @@ public class ColdcardMultisig implements WalletImport, KeystoreFileImport, Walle
return wallet;
} catch(Exception e) {
log.error("Error importing Coldcard multisig wallet", e);
throw new ImportException("Error importing Coldcard multisig wallet", e);
log.error("Error importing " + getName() + " wallet", e);
throw new ImportException("Error importing " + getName() + " wallet", e);
}
}
@ -203,8 +203,8 @@ public class ColdcardMultisig implements WalletImport, KeystoreFileImport, Walle
writer.flush();
} catch(Exception e) {
log.error("Error exporting Coldcard multisig wallet", e);
throw new ExportException("Error exporting Coldcard multisig wallet", e);
log.error("Error exporting " + getName() + " wallet", e);
throw new ExportException("Error exporting " + getName() + " wallet", e);
}
}

4
src/main/java/com/sparrowwallet/sparrow/io/ColdcardSinglesig.java

@ -86,8 +86,8 @@ public class ColdcardSinglesig implements KeystoreFileImport, WalletImport {
}
}
} catch (Exception e) {
log.error("Error getting Coldcard keystore", e);
throw new ImportException("Error getting Coldcard keystore", e);
log.error("Error getting " + getName() + " keystore", e);
throw new ImportException("Error getting " + getName() + " keystore", e);
}
throw new ImportException("Correct derivation not found for script type: " + scriptType);

10
src/main/java/com/sparrowwallet/sparrow/io/KeystoneSinglesig.java

@ -62,11 +62,11 @@ public class KeystoneSinglesig implements KeystoreFileImport, WalletImport {
return keystore;
} catch (IllegalArgumentException e) {
log.error("Error getting Keystone keystore - not an output descriptor");
throw new ImportException("Error getting Keystone keystore", e);
log.error("Error getting " + getName() + " keystore - not an output descriptor");
throw new ImportException("Error getting " + getName() + " keystore", e);
} catch (Exception e) {
log.error("Error getting Keystone keystore", e);
throw new ImportException("Error getting Keystone keystore", e);
log.error("Error getting " + getName() + " keystore", e);
throw new ImportException("Error getting " + getName() + " keystore", e);
}
}
@ -89,7 +89,7 @@ public class KeystoneSinglesig implements KeystoreFileImport, WalletImport {
try {
wallet.checkWallet();
} 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;

2
src/main/java/com/sparrowwallet/sparrow/io/Sparrow.java

@ -46,7 +46,7 @@ public class Sparrow implements WalletImport, WalletExport {
@Override
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

8
src/main/java/com/sparrowwallet/sparrow/io/SpecterDIY.java

@ -35,8 +35,8 @@ public class SpecterDIY implements KeystoreFileImport, WalletExport {
return keystore;
} catch(IOException e) {
log.error("Error getting Specter DIY keystore", e);
throw new ImportException("Error getting Specter DIY keystore", e);
log.error("Error getting " + getName() + " 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.flush();
} catch(Exception e) {
log.error("Error exporting Specter DIY wallet", e);
throw new ExportException("Error exporting Specter DIY wallet", e);
log.error("Error exporting " + getName() + " wallet", e);
throw new ExportException("Error exporting " + getName() + " wallet", e);
}
}

12
src/main/java/com/sparrowwallet/sparrow/io/SpecterDesktop.java

@ -30,8 +30,8 @@ public class SpecterDesktop implements WalletImport, WalletExport {
outputStream.write(json.getBytes(StandardCharsets.UTF_8));
outputStream.flush();
} catch(Exception e) {
log.error("Error exporting Specter Desktop wallet", e);
throw new ExportException("Error exporting Specter Desktop wallet", e);
log.error("Error exporting " + getName() + " wallet", e);
throw new ExportException("Error exporting " + getName() + " wallet", e);
}
}
@ -87,17 +87,17 @@ public class SpecterDesktop implements WalletImport, WalletExport {
try {
wallet.checkWallet();
} 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;
}
} catch(Exception e) {
log.error("Error importing Specter Desktop wallet", e);
throw new ImportException("Error importing Specter Desktop wallet", e);
log.error("Error importing " + getName() + " 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

7
src/main/java/com/sparrowwallet/sparrow/wallet/TransactionsController.java

@ -161,8 +161,11 @@ public class TransactionsController extends WalletFormController implements Init
String date = LOG_DATE_FORMAT.format(new Date());
String logLine = "\n" + date + " " + logMessage;
Platform.runLater(() -> {
loadingLog.appendText(logLine);
loadingLog.setScrollLeft(0);
int lastLineStart = loadingLog.getText().lastIndexOf("\n");
if(lastLineStart < 0 || !loadingLog.getText().substring(lastLineStart).equals(logLine)) {
loadingLog.appendText(logLine);
loadingLog.setScrollLeft(0);
}
});
}
}

Loading…
Cancel
Save