Be more informative when the signature has an invalid type

This commit is contained in:
Wilson Silva 2024-03-19 14:18:54 +00:00
parent 1ff9611051
commit 04574cc836
No known key found for this signature in database
GPG Key ID: 65135F94E23F82C8
3 changed files with 3 additions and 3 deletions

View File

@ -11,6 +11,6 @@ module Nostr
# @example # @example
# InvalidSignatureTypeError.new # 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
end end

View File

@ -7,7 +7,7 @@ RSpec.describe Nostr::InvalidSignatureTypeError do
let(:error) { described_class.new } let(:error) { described_class.new }
it 'builds a useful error message' do 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 end
end end

View File

@ -15,7 +15,7 @@ RSpec.describe Nostr::Signature do
it 'raises an InvalidSignatureTypeError' do it 'raises an InvalidSignatureTypeError' do
expect { described_class.new(1234) }.to raise_error( expect { described_class.new(1234) }.to raise_error(
Nostr::InvalidSignatureTypeError, Nostr::InvalidSignatureTypeError,
'Invalid signature type' 'Invalid signature type. It must be a string with lowercase hexadecimal characters.'
) )
end end
end end