Пример #1
0
func (d walkthroughEntityDelegate) Validate(e ab.Entity) error {
	wt := e.(*Walkthrough)

	if wt.Name == "" {
		return ab.NewVerboseError("", "name must not be empty")
	}

	if wt.UID == "" {
		return ab.NewVerboseError("", "uid must not be empty")
	}

	if len(wt.Steps) == 0 {
		return ab.NewVerboseError("", "a walkthrough must have at least one step")
	}

	return nil
}
Пример #2
0
func (d *PasswordDelegate) GetDBErrorConverter() func(err *pq.Error) ab.VerboseError {
	return func(err *pq.Error) ab.VerboseError {
		return ab.NewVerboseError(err.Error(), "")
	}
}