mirror of
https://github.com/hamburghammer/gstat.git
synced 2024-09-28 23:26:05 +02:00
24 lines
649 B
Go
24 lines
649 B
Go
package args
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
e "github.com/hamburghammer/gstat/errors"
|
|
)
|
|
|
|
// OperationKeyValidation represents the key for the Operation field of an ValidationError
|
|
const OperationKeyValidation = "Validation"
|
|
|
|
// ValidationError is a struct to wrap the error with more information.
|
|
type ValidationError struct {
|
|
e.BaseError
|
|
Arguments
|
|
}
|
|
|
|
func (ve *ValidationError) Error() string {
|
|
return fmt.Sprintf("%s of the arguments %+v failed: %s", ve.Operation, ve.Arguments, ve.Message)
|
|
}
|
|
|
|
func newValidationError(args Arguments, message string) ValidationError {
|
|
return ValidationError{e.BaseError{Operation: "Validation", Message: message}, args}
|
|
}
|