From 599880ea5cb701220b38f9376ff4d4be0fc72992 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Thu, 25 Apr 2024 15:21:13 +0200 Subject: [PATCH] improve samourai backup import error message --- src/main/java/com/sparrowwallet/sparrow/io/Samourai.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/io/Samourai.java b/src/main/java/com/sparrowwallet/sparrow/io/Samourai.java index 6c1ad73e..6459c09d 100644 --- a/src/main/java/com/sparrowwallet/sparrow/io/Samourai.java +++ b/src/main/java/com/sparrowwallet/sparrow/io/Samourai.java @@ -3,6 +3,7 @@ package com.sparrowwallet.sparrow.io; import com.google.common.io.CharStreams; import com.google.gson.Gson; import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; import com.google.gson.reflect.TypeToken; import com.sparrowwallet.drongo.Utils; import com.sparrowwallet.drongo.crypto.SamouraiUtil; @@ -57,6 +58,8 @@ public class Samourai implements KeystoreFileImport { Keystore keystore = Keystore.fromSeed(seed, scriptType.getDefaultDerivation()); keystore.setLabel(getWalletModel().toDisplayString()); return keystore; + } catch(JsonParseException e) { + throw new ImportException("Failed to decrypt the wallet backup file, check if the password is correct."); } catch(ImportException e) { throw e; } catch(Exception e) {