command: remove the obsolete Error support code

This commit is contained in:
Max Kellermann 2016-11-10 12:51:22 +01:00
parent 43b285ef7a
commit 741c6f1179
4 changed files with 1 additions and 42 deletions

View File

@ -39,7 +39,6 @@
#include "client/Response.hxx" #include "client/Response.hxx"
#include "util/Macros.hxx" #include "util/Macros.hxx"
#include "util/Tokenizer.hxx" #include "util/Tokenizer.hxx"
#include "util/Error.hxx"
#include "util/StringAPI.hxx" #include "util/StringAPI.hxx"
#ifdef ENABLE_SQLITE #ifdef ENABLE_SQLITE
@ -418,8 +417,4 @@ try {
Response r(client, num); Response r(client, num);
PrintError(r, std::current_exception()); PrintError(r, std::current_exception());
return CommandResult::ERROR; return CommandResult::ERROR;
} catch (const Error &error) {
Response r(client, num);
print_error(r, error);
return CommandResult::ERROR;
} }

View File

@ -22,7 +22,6 @@
#include "PlaylistError.hxx" #include "PlaylistError.hxx"
#include "db/DatabaseError.hxx" #include "db/DatabaseError.hxx"
#include "client/Response.hxx" #include "client/Response.hxx"
#include "util/Error.hxx"
#include "Log.hxx" #include "Log.hxx"
#include <system_error> #include <system_error>
@ -82,30 +81,6 @@ ToAck(DatabaseErrorCode code)
} }
#endif #endif
gcc_pure
static enum ack
ToAck(const Error &error)
{
if (error.IsDomain(ack_domain)) {
return (enum ack)error.GetCode();
} else if (error.IsDomain(errno_domain)) {
return ACK_ERROR_SYSTEM;
}
return ACK_ERROR_UNKNOWN;
}
CommandResult
print_error(Response &r, const Error &error)
{
assert(error.IsDefined());
LogError(error);
r.Error(ToAck(error), error.GetMessage());
return CommandResult::ERROR;
}
gcc_pure gcc_pure
static enum ack static enum ack
ToAck(std::exception_ptr ep) ToAck(std::exception_ptr ep)
@ -125,8 +100,6 @@ ToAck(std::exception_ptr ep)
#if defined(__GLIBCXX__) && __GLIBCXX__ < 20151204 #if defined(__GLIBCXX__) && __GLIBCXX__ < 20151204
} catch (const std::exception &e) { } catch (const std::exception &e) {
#else #else
} catch (const Error &error) {
return ToAck(error);
} catch (...) { } catch (...) {
#endif #endif
try { try {
@ -152,8 +125,6 @@ PrintError(Response &r, std::exception_ptr ep)
} catch (const std::exception &e) { } catch (const std::exception &e) {
LogError(e); LogError(e);
r.Error(ToAck(ep), e.what()); r.Error(ToAck(ep), e.what());
} catch (const Error &error) {
print_error(r, error);
} catch (...) { } catch (...) {
r.Error(ACK_ERROR_UNKNOWN, "Unknown error"); r.Error(ACK_ERROR_UNKNOWN, "Unknown error");
} }

View File

@ -25,14 +25,10 @@
#include <exception> #include <exception>
class Response; class Response;
class Error;
/** /**
* Send the #Error to the client. * Send the exception to the client.
*/ */
CommandResult
print_error(Response &r, const Error &error);
void void
PrintError(Response &r, std::exception_ptr ep); PrintError(Response &r, std::exception_ptr ep);

View File

@ -32,7 +32,6 @@
#include "AudioFormat.hxx" #include "AudioFormat.hxx"
#include "ReplayGainConfig.hxx" #include "ReplayGainConfig.hxx"
#include "util/ScopeExit.hxx" #include "util/ScopeExit.hxx"
#include "util/Error.hxx"
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
#include "db/update/Service.hxx" #include "db/update/Service.hxx"
@ -196,8 +195,6 @@ handle_status(Client &client, gcc_unused Request args, Response &r)
client.player_control.LockCheckRethrowError(); client.player_control.LockCheckRethrowError();
} catch (const std::exception &e) { } catch (const std::exception &e) {
r.Format(COMMAND_STATUS_ERROR ": %s\n", e.what()); r.Format(COMMAND_STATUS_ERROR ": %s\n", e.what());
} catch (const Error &error) {
r.Format(COMMAND_STATUS_ERROR ": %s\n", error.GetMessage());
} catch (...) { } catch (...) {
r.Format(COMMAND_STATUS_ERROR ": unknown\n"); r.Format(COMMAND_STATUS_ERROR ": unknown\n");
} }