forked from concourse/concourse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
38 lines (30 loc) · 785 Bytes
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package runtime
import "fmt"
// FileNotFoundError is the error to return from StreamFile when the given path
// does not exist.
type FileNotFoundError struct {
Path string
}
// Error prints a helpful message including the file path. The user will see
// this message if e.g. their task config path does not exist.
func (err FileNotFoundError) Error() string {
return fmt.Sprintf("file not found: %s", err.Path)
}
type ErrResourceScriptFailed struct {
Path string
Args []string
ExitStatus int
Stderr string
}
func (err ErrResourceScriptFailed) Error() string {
msg := fmt.Sprintf(
"resource script '%s %v' failed: exit status %d",
err.Path,
err.Args,
err.ExitStatus,
)
if len(err.Stderr) > 0 {
msg += "\n\nstderr:\n" + err.Stderr
}
return msg
}