@@ -3,6 +3,7 @@ package errors
33import (
44 "fmt"
55 "net/http"
6+ "path/filepath"
67 "time"
78
89 "github.com/Masterminds/semver/v3"
@@ -24,7 +25,7 @@ func (err TaskfileNotFoundError) Error() string {
2425 if err .AskInit {
2526 walkText += " Run `task --init` to create a new Taskfile."
2627 }
27- return fmt .Sprintf (`task: No Taskfile found at %q%s` , err .URI , walkText )
28+ return fmt .Sprintf (`task: No Taskfile found at %q%s` , filepath . ToSlash ( err .URI ) , walkText )
2829}
2930
3031func (err TaskfileNotFoundError ) Code () int {
@@ -51,7 +52,7 @@ type TaskfileInvalidError struct {
5152}
5253
5354func (err TaskfileInvalidError ) Error () string {
54- return fmt .Sprintf ("task: Failed to parse %s:\n %v" , err .URI , err .Err )
55+ return fmt .Sprintf ("task: Failed to parse %s:\n %v" , filepath . ToSlash ( err .URI ) , err .Err )
5556}
5657
5758func (err TaskfileInvalidError ) Code () int {
@@ -70,7 +71,7 @@ func (err TaskfileFetchFailedError) Error() string {
7071 if err .HTTPStatusCode != 0 {
7172 statusText = fmt .Sprintf (" with status code %d (%s)" , err .HTTPStatusCode , http .StatusText (err .HTTPStatusCode ))
7273 }
73- return fmt .Sprintf (`task: Download of %q failed%s` , err .URI , statusText )
74+ return fmt .Sprintf (`task: Download of %q failed%s` , filepath . ToSlash ( err .URI ) , statusText )
7475}
7576
7677func (err TaskfileFetchFailedError ) Code () int {
@@ -86,7 +87,7 @@ type TaskfileNotTrustedError struct {
8687func (err * TaskfileNotTrustedError ) Error () string {
8788 return fmt .Sprintf (
8889 `task: Taskfile %q not trusted by user` ,
89- err .URI ,
90+ filepath . ToSlash ( err .URI ) ,
9091 )
9192}
9293
@@ -103,7 +104,7 @@ type TaskfileNotSecureError struct {
103104func (err * TaskfileNotSecureError ) Error () string {
104105 return fmt .Sprintf (
105106 `task: Taskfile %q cannot be downloaded over an insecure connection. You can override this by using the --insecure flag` ,
106- err .URI ,
107+ filepath . ToSlash ( err .URI ) ,
107108 )
108109}
109110
@@ -120,7 +121,7 @@ type TaskfileCacheNotFoundError struct {
120121func (err * TaskfileCacheNotFoundError ) Error () string {
121122 return fmt .Sprintf (
122123 `task: Taskfile %q was not found in the cache. Remove the --offline flag to use a remote copy or download it using the --download flag` ,
123- err .URI ,
124+ filepath . ToSlash ( err .URI ) ,
124125 )
125126}
126127
@@ -141,12 +142,12 @@ func (err *TaskfileVersionCheckError) Error() string {
141142 if err .SchemaVersion == nil {
142143 return fmt .Sprintf (
143144 `task: Missing schema version in Taskfile %q` ,
144- err .URI ,
145+ filepath . ToSlash ( err .URI ) ,
145146 )
146147 }
147148 return fmt .Sprintf (
148149 "task: Invalid schema version in Taskfile %q:\n Schema version (%s) %s" ,
149- err .URI ,
150+ filepath . ToSlash ( err .URI ) ,
150151 err .SchemaVersion .String (),
151152 err .Message ,
152153 )
@@ -166,7 +167,7 @@ type TaskfileNetworkTimeoutError struct {
166167func (err * TaskfileNetworkTimeoutError ) Error () string {
167168 return fmt .Sprintf (
168169 `task: Network connection timed out after %s while attempting to download Taskfile %q` ,
169- err .Timeout , err .URI ,
170+ err .Timeout , filepath . ToSlash ( err .URI ) ,
170171 )
171172}
172173
@@ -183,8 +184,8 @@ type TaskfileCycleError struct {
183184
184185func (err TaskfileCycleError ) Error () string {
185186 return fmt .Sprintf ("task: include cycle detected between %s <--> %s" ,
186- err .Source ,
187- err .Destination ,
187+ filepath . ToSlash ( err .Source ) ,
188+ filepath . ToSlash ( err .Destination ) ,
188189 )
189190}
190191
@@ -203,7 +204,7 @@ type TaskfileDoesNotMatchChecksum struct {
203204func (err * TaskfileDoesNotMatchChecksum ) Error () string {
204205 return fmt .Sprintf (
205206 "task: The checksum of the Taskfile at %q does not match!\n got: %q\n want: %q" ,
206- err .URI ,
207+ filepath . ToSlash ( err .URI ) ,
207208 err .ActualChecksum ,
208209 err .ExpectedChecksum ,
209210 )
0 commit comments