From f455dd4bca3c991a20dccbf7fe8cd20461560c28 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 17 Jan 2024 10:45:35 -0500 Subject: [PATCH] Raise NoTranscation if tx not found --- lib/electrum.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/electrum.rb b/lib/electrum.rb index 6ef56e9b9d0294a9a6c4a17b2c1b6d6560bb2960..32e685541e5ac8b85216986d6c8c344f60cb8084 100644 --- a/lib/electrum.rb +++ b/lib/electrum.rb @@ -6,6 +6,8 @@ require "net/http" require "securerandom" class Electrum + class NoTransaction < StandardError; end + def initialize(rpc_uri:, rpc_username:, rpc_password:) @rpc_uri = URI(rpc_uri) @rpc_username = rpc_username @@ -37,6 +39,8 @@ class Electrum class Transaction def initialize(electrum, tx_hash, tx) + raise NoTransaction, "No tx found for #{tx_hash}" unless tx + @electrum = electrum @tx_hash = tx_hash @tx = tx