diff --git a/.vscode/launch.json b/.vscode/launch.json index df70224..c0c1931 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -12,7 +12,7 @@ "program": "${workspaceFolder}/main.go", "env": {}, // "args": ["active", "logs", "1585955316987", "details", "1587147792662", "-f", "json"] - "args": ["connect", "aws"] + "args": ["active", "list"] } ] } \ No newline at end of file diff --git a/pkg/api/api.go b/pkg/api/api.go index 75d4482..232ae89 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -62,5 +62,12 @@ func call(path string, verb string, payload interface{ io.Reader }) ([]byte, err os.Exit(1) } + // check for an HTML response which would indicate an error + html := string(contents[0:15]) + if html == "" { + fmt.Println("snap: token expired; please log in again") + os.Exit(1) + } + return contents, nil }