Skip to content

dapr cli could be more helpful reporting docker/podman errors #1594

@xverges

Description

@xverges

Describe the proposal

Right now, dapr will return the error message as returned by underlying command. The use is likely to lack the full context to solve the issue. If the command were supplied in addition to the error message, debugging would be easier.

This could be combined with a verbose mode that printed all the commands.

e.g.

        err = cmd.Wait()
        if err != nil {
-               // in case of error, capture the exact message.
-               if len(errB) > 0 {
-                       return "", errors.New(string(errB))
+               cmdStr := name + " " + strings.Join(args, " ")
+               output := strings.TrimSpace(string(errB))
+               if output == "" {
+                       output = strings.TrimSpace(string(resp))
                }
-               return "", err
+               if output != "" {
+                       return "", fmt.Errorf("error running \"%s\": %s", cmdStr, output)
+               }
+               return "", fmt.Errorf("error running \"%s\": %w", cmdStr, err)
        }

See #1581 for an example failure that could have benefited from information about the command that failed.

Release Note

RELEASE NOTE:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/proposalA new proposal to be considered

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions