diff options
author | Guillaume Maudoux <guillaume.maudoux@tweag.io> | 2022-04-29 00:12:25 +0200 |
---|---|---|
committer | Guillaume Maudoux <guillaume.maudoux@tweag.io> | 2022-04-29 00:12:25 +0200 |
commit | e93b59fbc5ada40e77d6f2b2a8bbd8e482418d6a (patch) | |
tree | f9436753bba299d648a6721845a9465b34a50062 /src/libutil/error.hh | |
parent | f6baa4d18845297f3f7fc2434b7ade93a45718e7 (diff) | |
parent | 35393dc2c65765acb6cc99d6a976eab62c28a51d (diff) |
Merge remote-tracking branch 'origin/master' into coerce-string
Diffstat (limited to 'src/libutil/error.hh')
-rw-r--r-- | src/libutil/error.hh | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/libutil/error.hh b/src/libutil/error.hh index 2bc3cd2d5..2172cb988 100644 --- a/src/libutil/error.hh +++ b/src/libutil/error.hh @@ -87,11 +87,7 @@ struct ErrPos { origin = pos.origin; line = pos.line; column = pos.column; - // is file symbol null? - if (pos.file.set()) - file = pos.file; - else - file = ""; + file = pos.file; return *this; } @@ -109,7 +105,6 @@ struct Trace { struct ErrorInfo { Verbosity level; - std::string name; // FIXME: rename hintformat msg; std::optional<ErrPos> errPos; std::list<Trace> traces; @@ -164,8 +159,6 @@ public: : err(e) { } - virtual const char* sname() const { return "BaseError"; } - #ifdef EXCEPTION_NEEDS_THROW_SPEC ~BaseError() throw () { }; const char * what() const throw () { return calcWhat().c_str(); } @@ -181,12 +174,12 @@ public: } template<typename... Args> - BaseError & addTrace(std::optional<ErrPos> e, const std::string_view & fs, const Args & ... args) + void addTrace(std::optional<ErrPos> e, std::string_view fs, const Args & ... args) { - return addTrace(e, hintfmt(std::string(fs), args...)); + addTrace(e, hintfmt(std::string(fs), args...)); } - BaseError & addTrace(std::optional<ErrPos> e, hintformat hint); + void addTrace(std::optional<ErrPos> e, hintformat hint); bool hasTrace() const { return !err.traces.empty(); } }; @@ -196,7 +189,6 @@ public: { \ public: \ using superClass::superClass; \ - virtual const char* sname() const override { return #newClass; } \ } MakeError(Error, BaseError); @@ -216,8 +208,6 @@ public: auto hf = hintfmt(args...); err.msg = hintfmt("%1%: %2%", normaltxt(hf.str()), strerror(errNo)); } - - virtual const char* sname() const override { return "SysError"; } }; } |