diff options
| -rw-r--r-- | errors.go | 8 | ||||
| -rw-r--r-- | trunks.go | 3 |
2 files changed, 11 insertions, 0 deletions
@@ -35,6 +35,14 @@ func errAttackNotAllowed() error { return res } +var errAttackHandlerNotSet = libhttp.EndpointResponse{ + E: liberrors.E{ + Code: http.StatusNotAcceptable, + Message: `the Attack handler is not set`, + Name: `ERR_ATTACK_HANDLER_NOT_SET`, + }, +} + func errInternal(err error) error { res := &libhttp.EndpointResponse{ E: liberrors.E{ @@ -108,6 +108,9 @@ func (trunks *Trunks) AttackHttp(req *RunRequest) (err error) { if !origHttpTarget.AllowAttack { return errAttackNotAllowed() } + if origHttpTarget.Attack == nil { + return fmt.Errorf(`%s: %w`, logp, &errAttackHandlerNotSet) + } req = generateRunRequest(trunks.Env, req, origTarget, origHttpTarget) |
