improve error message
This commit is contained in:
parent
6e9755b009
commit
6c42969d01
|
@ -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();
|
||||||
|
|
|
@ -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…
Reference in New Issue