diff --git a/src/cli.cc b/src/cli.cc index a1964bc..f2c2b7b 100644 --- a/src/cli.cc +++ b/src/cli.cc @@ -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) diff --git a/src/opustags.h b/src/opustags.h index 173e331..e98c5d0 100644 --- a/src/opustags.h +++ b/src/opustags.h @@ -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, }; /**