... | ... |
@@ -97,6 +97,9 @@ func (r *REST) Get(ctx kapi.Context, name string, opts runtime.Object) (runtime. |
97 | 97 |
} |
98 | 98 |
location, transport, err := pod.LogLocation(r.PodGetter, r.ConnectionInfo, ctx, buildPodName, logOpts) |
99 | 99 |
if err != nil { |
100 |
+ if errors.IsNotFound(err) { |
|
101 |
+ return nil, errors.NewNotFound("pod", buildPodName) |
|
102 |
+ } |
|
100 | 103 |
return nil, errors.NewBadRequest(err.Error()) |
101 | 104 |
} |
102 | 105 |
return &genericrest.LocationStreamer{ |
... | ... |
@@ -3,6 +3,7 @@ package cmd |
3 | 3 |
import ( |
4 | 4 |
"fmt" |
5 | 5 |
"io" |
6 |
+ "net/http" |
|
6 | 7 |
"os" |
7 | 8 |
"strings" |
8 | 9 |
|
... | ... |
@@ -44,6 +45,15 @@ func NewCmdBuildLogs(fullName string, f *clientcmd.Factory, out io.Writer) *cobr |
44 | 44 |
fmt.Fprintf(out, msg) |
45 | 45 |
os.Exit(1) |
46 | 46 |
} |
47 |
+ if err.Status().Code == http.StatusNotFound { |
|
48 |
+ switch err.Status().Details.Kind { |
|
49 |
+ case "build": |
|
50 |
+ fmt.Fprintf(out, "The build %s could not be found. Therefore build logs cannot be retrieved.\n", err.Status().Details.Name) |
|
51 |
+ case "pod": |
|
52 |
+ fmt.Fprintf(out, "The pod %s for build %s could not be found. Therefore build logs cannot be retrieved.\n", err.Status().Details.Name, args[0]) |
|
53 |
+ } |
|
54 |
+ os.Exit(1) |
|
55 |
+ } |
|
47 | 56 |
} |
48 | 57 |
cmdutil.CheckErr(err) |
49 | 58 |
}, |