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

This commit is contained in:
Max Kellermann
2016-10-29 10:59:18 +02:00
parent df142d4f61
commit a2e3dc0592
3 changed files with 10 additions and 16 deletions

View File

@@ -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;
}

View File

@@ -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();