Skip to content

Instantly share code, notes, and snippets.

@draveness
Last active March 12, 2019 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save draveness/2567fccb9ea5271aa0f5e0488bdf793c to your computer and use it in GitHub Desktop.
Save draveness/2567fccb9ea5271aa0f5e0488bdf793c to your computer and use it in GitHub Desktop.
errors.New("invalid parameter a")
errors.New("invalid parameter b")
errors.New("Record Not Found")
var ErrRecordNotFound = errors.New("Record Not Found")
type ErrParam struct {
value string
}
func (e *ErrParam) Error() string {
return "invalid paramater " + e.value
}
func NewErrParam(value string) ErrParam {
return ErrParam{value: value}
}
NewErrParam("a")
NewErrParam("b")
ErrRecordNotFound
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment