1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-11-23 21:44:44 +02:00

Move "skip ci" logic into global pipeline conditions (#2216)

... and make custom errors follow std err conventions

this fix a 500 response if the whole pipeline is filtered out
This commit is contained in:
6543
2023-08-17 15:52:43 +02:00
committed by GitHub
parent 2222638b10
commit a5ef372190
6 changed files with 41 additions and 20 deletions

View File

@@ -22,6 +22,14 @@ func (e ErrNotFound) Error() string {
return e.Msg
}
func (e ErrNotFound) Is(target error) bool {
_, ok := target.(ErrNotFound) //nolint:errorlint
if !ok {
_, ok = target.(*ErrNotFound) //nolint:errorlint
}
return ok
}
type ErrBadRequest struct {
Msg string
}
@@ -30,6 +38,14 @@ func (e ErrBadRequest) Error() string {
return e.Msg
}
func (e ErrBadRequest) Is(target error) bool {
_, ok := target.(ErrBadRequest) //nolint:errorlint
if !ok {
_, ok = target.(*ErrBadRequest) //nolint:errorlint
}
return ok
}
type ErrFiltered struct {
Msg string
}
@@ -37,3 +53,11 @@ type ErrFiltered struct {
func (e ErrFiltered) Error() string {
return "ignoring hook: " + e.Msg
}
func (e *ErrFiltered) Is(target error) bool {
_, ok := target.(ErrFiltered) //nolint:errorlint
if !ok {
_, ok = target.(*ErrFiltered) //nolint:errorlint
}
return ok
}