Skip to content

Commit

Permalink
Improve error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
NullHypothesis committed Oct 27, 2024
1 parent a6bb8e8 commit 1adcf6a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/nonce/nonce.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"crypto/rand"
"encoding/base64"
"errors"
"fmt"
"net/url"

"github.com/Amnesic-Systems/veil/internal/errs"
Expand Down Expand Up @@ -48,7 +49,8 @@ func New() (*Nonce, error) {
// FromSlice turns a byte slice into a nonce.
func FromSlice(s []byte) (*Nonce, error) {
if len(s) < Len {
return nil, errs.InvalidLength
return nil, fmt.Errorf("%w: slice len is %d but need at least %d",
errs.InvalidLength, len(s), Len)
}

var n Nonce
Expand Down

0 comments on commit 1adcf6a

Please sign in to comment.