Skip to content

Commit

Permalink
feat: add hash struct
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie authored Sep 9, 2024
1 parent 75c76d9 commit b6717c6
Show file tree
Hide file tree
Showing 3 changed files with 493 additions and 0 deletions.
22 changes: 22 additions & 0 deletions hash/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package hash

import (
"fmt"
)

// ErrNotStringer is returned when there's an error with hash:"string"
type ErrNotStringer struct {
Field string
}

// Error implements error for ErrNotStringer
func (ens *ErrNotStringer) Error() string {
return fmt.Sprintf("hash: %s has hash:\"string\" set, but does not implement fmt.Stringer", ens.Field)
}

// ErrFormat is returned when an invalid format is given to the Hash function.
type ErrFormat struct{}

func (*ErrFormat) Error() string {
return "format must be one of the defined Format values in the hash library"
}
Loading

0 comments on commit b6717c6

Please sign in to comment.