From 3ec960c60934be246761f751aa4d195a7d15d638 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Sun, 29 Jan 2023 15:38:40 +0200 Subject: [PATCH] mu: improve mu-error Add specific error-code for SchemaMismatch Combine find/cfind no-matches --- lib/utils/mu-error.hh | 5 ++--- mu/mu-cmd-cfind.cc | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/utils/mu-error.hh b/lib/utils/mu-error.hh index 6472ce83..2962aba8 100644 --- a/lib/utils/mu-error.hh +++ b/lib/utils/mu-error.hh @@ -43,19 +43,18 @@ struct Error final : public std::exception { AccessDenied = ERROR_ENUM(1,0), AssertionFailure = ERROR_ENUM(1,0), Command = ERROR_ENUM(1,0), - ContactNotFound = ERROR_ENUM(2,SoftError), Crypto = ERROR_ENUM(1,0), File = ERROR_ENUM(1,0), Index = ERROR_ENUM(1,0), Internal = ERROR_ENUM(1,0), InvalidArgument = ERROR_ENUM(1,0), Message = ERROR_ENUM(1,0), - NoMatches = ERROR_ENUM(4,SoftError), + NoMatches = ERROR_ENUM(2,SoftError), NotFound = ERROR_ENUM(1,0), Parsing = ERROR_ENUM(1,0), Play = ERROR_ENUM(1,0), Query = ERROR_ENUM(1,0), - SchemaMismatch = ERROR_ENUM(1,0), + SchemaMismatch = ERROR_ENUM(11,0), Script = ERROR_ENUM(1,0), ScriptNotFound = ERROR_ENUM(1,0), Store = ERROR_ENUM(1,0), diff --git a/mu/mu-cmd-cfind.cc b/mu/mu-cmd-cfind.cc index 141da344..dcd14c36 100644 --- a/mu/mu-cmd-cfind.cc +++ b/mu/mu-cmd-cfind.cc @@ -315,7 +315,7 @@ Mu::mu_cmd_cfind(const Mu::Store& store, const Mu::Options& opts) }); 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); return Ok();