Skip to content

Improve CLI error handling  #41

Open
@maidul98

Description

@maidul98

The current error handeling is not comprehensive as there is no way to add a equivalent friendly message from the cause of an error.

For example, here in the login command we check if the user is already logged in. In the method to check if they are logged in, we just retrun the error as is shown

return false, "", err

This is problematic because at the command level package, we have to guess exactly why the login check failed. It would be much better, if we can add a helpful message from the login check method so that we do not have to guess the exact cause at command package level.

I propose that we add a new Error type like so

type Error struct {
	Err             error
	DebugMessage    string
	FriendlyMessage string
}

This will allow us to add a FriendlyMessage for every error, allowing us to print the exact message we want to show to the end user for any error message. Please ask questions if you need more clarification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Go LangThe programming language Gogood first issueGood for newcomershelp wantedOpen for contributions from the community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions