Commit a2e3dc05 authored by Max Kellermann's avatar Max Kellermann

db/Interface: migrate Update() from class Error to C++ exceptions

parent df142d4f
......@@ -36,7 +36,6 @@
#include "ls.hxx"
#include "mixer/Volume.hxx"
#include "util/UriUtil.hxx"
#include "util/Error.hxx"
#include "util/StringAPI.hxx"
#include "fs/AllocatedPath.hxx"
#include "Stats.hxx"
......@@ -277,13 +276,10 @@ static CommandResult
handle_update(Response &r, Database &db,
const char *uri_utf8, bool discard)
{
Error error;
unsigned id = db.Update(uri_utf8, discard, error);
unsigned id = db.Update(uri_utf8, discard);
if (id > 0) {
r.Format("updating_db: %i\n", id);
return CommandResult::OK;
} else if (error.IsDefined()) {
return print_error(r, error);
} else {
/* Database::Update() has returned 0 without setting
the Error: the method is not implemented */
......
......@@ -31,7 +31,6 @@ struct DatabasePlugin;
struct DatabaseStats;
struct DatabaseSelection;
struct LightSong;
class Error;
class Database {
const DatabasePlugin &plugin;
......@@ -111,14 +110,15 @@ public:
virtual DatabaseStats GetStats(const DatabaseSelection &selection) const = 0;
/**
* Update the database. Returns the job id on success, 0 on
* error (with #Error set) and 0 if not implemented (#Error
* not set).
* Update the database.
*
* Throws #std::runtime_error on error.
*
* @return the job id or 0 if not implemented
*/
virtual unsigned Update(gcc_unused const char *uri_utf8,
gcc_unused bool discard,
gcc_unused Error &error) {
/* not implemented: return 0 and don't set an Error */
gcc_unused bool discard) {
/* not implemented: return 0 */
return 0;
}
......
......@@ -124,8 +124,7 @@ public:
DatabaseStats GetStats(const DatabaseSelection &selection) const override;
virtual unsigned Update(const char *uri_utf8, bool discard,
Error &error) override;
unsigned Update(const char *uri_utf8, bool discard) override;
virtual time_t GetUpdateStamp() const override {
return update_stamp;
......@@ -820,8 +819,7 @@ ProxyDatabase::GetStats(const DatabaseSelection &selection) const
}
unsigned
ProxyDatabase::Update(const char *uri_utf8, bool discard,
gcc_unused Error &error)
ProxyDatabase::Update(const char *uri_utf8, bool discard)
{
EnsureConnected();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment