mu: improve mu-error

Add specific error-code for SchemaMismatch

Combine find/cfind no-matches
This commit is contained in:
Dirk-Jan C. Binnema 2023-01-29 15:38:40 +02:00
parent 4449ac9d29
commit 3ec960c609
2 changed files with 3 additions and 4 deletions

View File

@ -43,19 +43,18 @@ struct Error final : public std::exception {
AccessDenied = ERROR_ENUM(1,0), AccessDenied = ERROR_ENUM(1,0),
AssertionFailure = ERROR_ENUM(1,0), AssertionFailure = ERROR_ENUM(1,0),
Command = ERROR_ENUM(1,0), Command = ERROR_ENUM(1,0),
ContactNotFound = ERROR_ENUM(2,SoftError),
Crypto = ERROR_ENUM(1,0), Crypto = ERROR_ENUM(1,0),
File = ERROR_ENUM(1,0), File = ERROR_ENUM(1,0),
Index = ERROR_ENUM(1,0), Index = ERROR_ENUM(1,0),
Internal = ERROR_ENUM(1,0), Internal = ERROR_ENUM(1,0),
InvalidArgument = ERROR_ENUM(1,0), InvalidArgument = ERROR_ENUM(1,0),
Message = ERROR_ENUM(1,0), Message = ERROR_ENUM(1,0),
NoMatches = ERROR_ENUM(4,SoftError), NoMatches = ERROR_ENUM(2,SoftError),
NotFound = ERROR_ENUM(1,0), NotFound = ERROR_ENUM(1,0),
Parsing = ERROR_ENUM(1,0), Parsing = ERROR_ENUM(1,0),
Play = ERROR_ENUM(1,0), Play = ERROR_ENUM(1,0),
Query = ERROR_ENUM(1,0), Query = ERROR_ENUM(1,0),
SchemaMismatch = ERROR_ENUM(1,0), SchemaMismatch = ERROR_ENUM(11,0),
Script = ERROR_ENUM(1,0), Script = ERROR_ENUM(1,0),
ScriptNotFound = ERROR_ENUM(1,0), ScriptNotFound = ERROR_ENUM(1,0),
Store = ERROR_ENUM(1,0), Store = ERROR_ENUM(1,0),

View File

@ -315,7 +315,7 @@ Mu::mu_cmd_cfind(const Mu::Store& store, const Mu::Options& opts)
}); });
if (num == 0) if (num == 0)
return Err(Error::Code::ContactNotFound, "no matching contacts found"); return Err(Error::Code::NoMatches, "no matching contacts found");
output(ItemType::Footer, Nothing, opts); output(ItemType::Footer, Nothing, opts);
return Ok(); return Ok();