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
Errors like
invalid commit formatare 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:conventional-commit/src/lib.rs
Lines 205 to 221 in dbd1eb2
On top of that, we should probably switch to an
Errorstruct, which contains anErrorTypeenum, 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