Skip to content

Commit c8b23dd

Browse files
committed
refactor(Errors): uses better error formatting
1 parent a557026 commit c8b23dd

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/error.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ pub enum Error {
1515
TomlReadErr,
1616
/// Generated when an unrecognized link-style value is used
1717
LinkStyleErr,
18-
/// Generated when a string cannot be parsed to a SemVer value
19-
SemVerErr,
2018
/// Generated when there are errors creating the output file or stream
2119
CreateFileErr,
2220
/// Generated when there are errors writing to the changelog output file
@@ -37,8 +35,8 @@ impl Error {
3735

3836
/// Print this error and immediately exit the program.
3937
///
40-
/// If the error is non-fatal then the error is printed to stdout and the
41-
/// exit status will be `0`. Otherwise, when the error is fatal, the error
38+
/// If the error is non-fatal then the error is printed to stdout and the
39+
/// exit status will be `0`. Otherwise, when the error is fatal, the error
4240
/// is printed to stderr and the exit status will be `1`.
4341
pub fn exit(&self) -> ! {
4442
if self.is_fatal() {
@@ -62,16 +60,15 @@ impl fmt::Display for Error {
6260
impl StdError for Error {
6361
fn description(&self) -> &str {
6462
match *self {
65-
Error::ConfigParseErr => "clog: error parsing config file",
66-
Error::ConfigFormatErr => "clog: incorrect format for config file",
67-
Error::CurrentDirErr => "clog: cannot get current directory",
68-
Error::TomlReadErr => "clog: cannot read TOML config file",
69-
Error::LinkStyleErr => "clog: unrecognized link-style field",
70-
Error::SemVerErr => "clog: cannot parse SemVer version",
71-
Error::CreateFileErr => "clog: cannot create output file",
72-
Error::WriteErr => "clog: cannot write to output file or stream",
73-
Error::UnknownErr => "clog: unknown fatal error",
74-
Error::IoErr => "clog: fatal i/o error with output file"
63+
Error::ConfigParseErr => "error parsing config file",
64+
Error::ConfigFormatErr => "incorrect format for config file",
65+
Error::CurrentDirErr => "cannot get current directory",
66+
Error::TomlReadErr => "cannot read TOML config file",
67+
Error::LinkStyleErr => "unrecognized link-style field",
68+
Error::CreateFileErr => "cannot create output file",
69+
Error::WriteErr => "cannot write to output file or stream",
70+
Error::UnknownErr => "unknown fatal error",
71+
Error::IoErr => "fatal i/o error with output file"
7572
}
7673
}
7774

0 commit comments

Comments
 (0)