hook: Stop overmatching hooks errors
Currently the hook.CustomHookError
type is an alias for the error
interface. As a result, when we run errors.As(err, &customHookErr)
,
this will match against all errors. This leads us to treat all hooks
failures, such as internal errors returned from the internal/allowed
API endpoint as custom hook errors.
Convert hook.CustomHookError
to a struct so that the errors.As
matching is constrained to just this type.