MCPcopy Create free account
hub / github.com/go-task/task / Error

Method Error

errors/error_taskfile_decode.go:40–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38}
39
40func (err *TaskfileDecodeError) Error() string {
41 buf := &bytes.Buffer{}
42
43 // Print the error message
44 if err.Message != "" {
45 fmt.Fprintln(buf, color.RedString("err: %s", err.Message))
46 } else {
47 // Extract the errors from the TypeError
48 te := &yaml.TypeError{}
49 if errors.As(err.Err, &te) {
50 if len(te.Errors) > 1 {
51 fmt.Fprintln(buf, color.RedString("errs:"))
52 for _, message := range te.Errors {
53 fmt.Fprintln(buf, color.RedString("- %s", message))
54 }
55 } else {
56 fmt.Fprintln(buf, color.RedString("err: %s", te.Errors[0]))
57 }
58 } else {
59 // Otherwise print the error message normally
60 fmt.Fprintln(buf, color.RedString("err: %s", err.Err))
61 }
62 }
63 fmt.Fprintln(buf, color.RedString("file: %s:%d:%d", err.Location, err.Line, err.Column))
64 fmt.Fprint(buf, err.Snippet)
65 return buf.String()
66}
67
68func (err *TaskfileDecodeError) Debug() string {
69 const indentWidth = 2

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected