Browse Source

improve error message

patch-2
Ryan X. Charles 11 years ago
parent
commit
6c42969d01
  1. 2
      lib/ecdsa.js
  2. 2
      test/ecdsa.js

2
lib/ecdsa.js

@ -114,7 +114,7 @@ ECDSA.prototype.sig2pubkey = function() {
ECDSA.prototype.sigError = function() { ECDSA.prototype.sigError = function() {
if (!Buffer.isBuffer(this.hashbuf) || this.hashbuf.length !== 32) if (!Buffer.isBuffer(this.hashbuf) || this.hashbuf.length !== 32)
return 'Invalid hash'; return 'hashbuf must be a 32 byte buffer';
try { try {
this.keypair.pubkey.validate(); this.keypair.pubkey.validate();

2
test/ecdsa.js

@ -105,7 +105,7 @@ describe("ECDSA", function() {
it('should return an error if the hash is invalid', function() { it('should return an error if the hash is invalid', function() {
var ecdsa = new ECDSA(); var ecdsa = new ECDSA();
ecdsa.sigError().should.equal('Invalid hash'); ecdsa.sigError().should.equal('hashbuf must be a 32 byte buffer');
}); });
it('should return an error if the pubkey is invalid', function() { it('should return an error if the pubkey is invalid', function() {

Loading…
Cancel
Save