internal/worker: add String to clienterrors.Error struct

This should make the logging better when errors have another error
struct.

Fixes #3272
This commit is contained in:
Sanne Raymaekers 2023-02-08 16:33:13 +01:00
parent 5a62453190
commit 96b42b5791

View file

@ -1,5 +1,9 @@
package clienterrors
import (
"fmt"
)
const (
ErrorNoDynamicArgs ClientErrorCode = 1
ErrorInvalidTargetConfig ClientErrorCode = 2
@ -46,6 +50,10 @@ type Error struct {
Details interface{} `json:"details,omitempty"`
}
func (e *Error) String() string {
return fmt.Sprintf("Code: %d, Reason: %s, Details: %v", e.ID, e.Reason, e.Details)
}
const (
JobStatusSuccess = "2xx"
JobStatusUserInputError = "4xx"