Dawid Wysokiński
6415b162de
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #111
35 lines
528 B
Go
35 lines
528 B
Go
package domain
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
)
|
|
|
|
var ErrNothingToUpdate = errors.New("nothing to update")
|
|
|
|
type TranslatableError interface {
|
|
error
|
|
Slug() string
|
|
Params() map[string]any
|
|
}
|
|
|
|
type RequiredError struct {
|
|
Field string
|
|
}
|
|
|
|
var _ TranslatableError = RequiredError{}
|
|
|
|
func (e RequiredError) Error() string {
|
|
return fmt.Sprintf("%s can't be blank", e.Field)
|
|
}
|
|
|
|
func (e RequiredError) Slug() string {
|
|
return "required"
|
|
}
|
|
|
|
func (e RequiredError) Params() map[string]any {
|
|
return map[string]any{
|
|
"Field": e.Field,
|
|
}
|
|
}
|