Change summary
lib/electrum.rb | 4 ++++
1 file changed, 4 insertions(+)
Detailed changes
@@ -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