From 04574cc8360b57fe394ef252c86b0736a0a44de1 Mon Sep 17 00:00:00 2001 From: Wilson Silva Date: Tue, 19 Mar 2024 14:18:54 +0000 Subject: [PATCH] Be more informative when the signature has an invalid type --- lib/nostr/errors/invalid_signature_type_error.rb | 2 +- spec/nostr/errors/invalid_signature_type_error_spec.rb | 2 +- spec/nostr/signature_spec.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/nostr/errors/invalid_signature_type_error.rb b/lib/nostr/errors/invalid_signature_type_error.rb index bc389c9..07b1015 100644 --- a/lib/nostr/errors/invalid_signature_type_error.rb +++ b/lib/nostr/errors/invalid_signature_type_error.rb @@ -11,6 +11,6 @@ module Nostr # @example # InvalidSignatureTypeError.new # - def initialize = super('Invalid signature type') + def initialize = super('Invalid signature type. It must be a string with lowercase hexadecimal characters.') end end diff --git a/spec/nostr/errors/invalid_signature_type_error_spec.rb b/spec/nostr/errors/invalid_signature_type_error_spec.rb index d38db3d..2fb004e 100644 --- a/spec/nostr/errors/invalid_signature_type_error_spec.rb +++ b/spec/nostr/errors/invalid_signature_type_error_spec.rb @@ -7,7 +7,7 @@ RSpec.describe Nostr::InvalidSignatureTypeError do let(:error) { described_class.new } it 'builds a useful error message' do - expect(error.message).to eq('Invalid signature type') + expect(error.message).to eq('Invalid signature type. It must be a string with lowercase hexadecimal characters.') end end end diff --git a/spec/nostr/signature_spec.rb b/spec/nostr/signature_spec.rb index da20b36..f49513f 100644 --- a/spec/nostr/signature_spec.rb +++ b/spec/nostr/signature_spec.rb @@ -15,7 +15,7 @@ RSpec.describe Nostr::Signature do it 'raises an InvalidSignatureTypeError' do expect { described_class.new(1234) }.to raise_error( Nostr::InvalidSignatureTypeError, - 'Invalid signature type' + 'Invalid signature type. It must be a string with lowercase hexadecimal characters.' ) end end