Skip to content

Improve error output #2

@JeanMertz

Description

@JeanMertz

Errors like invalid commit format are non-descriptive, and make it hard to debug a problem. The error enum should prefer lots of very specific error cases as opposed to a few generic error cases:

pub enum Error {
/// The commit type is missing from the commit message.
MissingType,
/// The scope has an invalid format.
InvalidScope,
/// The description of the commit is missing.
MissingDescription,
/// The body of the commit has an invalid format.
InvalidBody,
/// Any other part of the commit does not conform to the conventional commit
/// spec.
InvalidFormat,
}

On top of that, we should probably switch to an Error struct, which contains an ErrorType enum, and some extra fields with more details about the error, to make it easier for libraries to inform the user what exactly went wrong, with which commit message.

cc: rustic-games/jilu#6

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions