mirror of
https://github.com/fmang/opustags.git
synced 2025-01-15 20:53:16 +01:00
fatal errors are not special
This commit is contained in:
parent
1d6ca8fc59
commit
fcfb4a2a1d
@ -246,7 +246,7 @@ static ot::status process(ot::ogg_reader& reader, ot::ogg_writer* writer, const
|
||||
return rc;
|
||||
}
|
||||
if (packet_count < 2)
|
||||
return {ot::st::fatal_error, "Expected at least 2 Ogg packets"};
|
||||
return {ot::st::error, "Expected at least 2 Ogg packets"};
|
||||
return ot::st::ok;
|
||||
}
|
||||
|
||||
@ -310,14 +310,14 @@ ot::status ot::run(const ot::options& opt)
|
||||
rc = temporary_output.open(opt.path_out.c_str());
|
||||
output = temporary_output.get();
|
||||
} else {
|
||||
rc = {ot::st::fatal_error,
|
||||
rc = {ot::st::error,
|
||||
"'" + opt.path_out + "' already exists. Use -y to overwrite."};
|
||||
}
|
||||
} else if (errno == ENOENT) {
|
||||
rc = temporary_output.open(opt.path_out.c_str());
|
||||
output = temporary_output.get();
|
||||
} else {
|
||||
rc = {ot::st::fatal_error,
|
||||
rc = {ot::st::error,
|
||||
"Could not identify '" + opt.path_in + "': " + strerror(errno)};
|
||||
}
|
||||
if (rc != ot::st::ok)
|
||||
|
@ -41,6 +41,9 @@ namespace ot {
|
||||
* have it explictly mentionned in their documentation. By default, a non-ok status should be
|
||||
* handled like an error.
|
||||
*
|
||||
* Error codes do not need to be ultra specific, and are mainly used to report special conditions to
|
||||
* the caller function. Ultimately, only the error message in the #status is shown to the user.
|
||||
*
|
||||
* The cut error family means that the end of packet was reached when attempting to read the
|
||||
* overflowing value. For example, cut_comment_count means that after reading the vendor string,
|
||||
* less than 4 bytes were left in the packet.
|
||||
@ -48,8 +51,9 @@ namespace ot {
|
||||
enum class st {
|
||||
/* Generic */
|
||||
ok,
|
||||
error,
|
||||
standard_error, /**< Error raised by the C standard library. */
|
||||
int_overflow,
|
||||
standard_error,
|
||||
/* Ogg */
|
||||
end_of_stream,
|
||||
end_of_page,
|
||||
@ -65,7 +69,6 @@ enum class st {
|
||||
cut_comment_data,
|
||||
/* CLI */
|
||||
bad_arguments,
|
||||
fatal_error,
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user