cmd/list: better error handling

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba 2021-04-22 11:56:48 -07:00
parent d2d0734eaa
commit b674ac21b4

View File

@ -70,15 +70,27 @@ func getCurrentDeploymentID(ctx context.Context, store *dagger.Store) string {
lg.Warn().Err(err).Msg("cannot get current working directory")
return ""
}
st, _ := store.LookupDeploymentByPath(ctx, wd)
st, err := store.LookupDeploymentByPath(ctx, wd)
if err != nil {
// Ignore error
return ""
}
if len(st) == 1 {
return st[0].ID
}
return ""
}
func formatPath(p string) string {
usr, _ := user.Current()
usr, err := user.Current()
if err != nil {
// Ignore error
return p
}
dir := usr.HomeDir
if strings.HasPrefix(p, dir) {