From 8d747ad47bfa145d91d6b99e360a5cbb0b00b2db Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Mon, 4 Mar 2019 14:30:08 +0100 Subject: [PATCH] Add ErrorReporter::fatalTypeError() with secondary location --- liblangutil/ErrorReporter.cpp | 15 +++++++++++++++ liblangutil/ErrorReporter.h | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/liblangutil/ErrorReporter.cpp b/liblangutil/ErrorReporter.cpp index fb01847d5..0bf3a4167 100644 --- a/liblangutil/ErrorReporter.cpp +++ b/liblangutil/ErrorReporter.cpp @@ -118,6 +118,12 @@ bool ErrorReporter::checkForExcessiveErrors(Error::Type _type) return false; } +void ErrorReporter::fatalError(Error::Type _type, SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description) +{ + error(_type, _location, _secondaryLocation, _description); + BOOST_THROW_EXCEPTION(FatalError()); +} + void ErrorReporter::fatalError(Error::Type _type, SourceLocation const& _location, string const& _description) { error(_type, _location, _description); @@ -207,6 +213,15 @@ void ErrorReporter::typeError(SourceLocation const& _location, string const& _de ); } +void ErrorReporter::fatalTypeError(SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description) +{ + fatalError( + Error::Type::TypeError, + _location, + _secondaryLocation, + _description + ); +} void ErrorReporter::fatalTypeError(SourceLocation const& _location, string const& _description) { diff --git a/liblangutil/ErrorReporter.h b/liblangutil/ErrorReporter.h index d7cea4cda..a31044c88 100644 --- a/liblangutil/ErrorReporter.h +++ b/liblangutil/ErrorReporter.h @@ -104,6 +104,7 @@ public: } void fatalTypeError(SourceLocation const& _location, std::string const& _description); + void fatalTypeError(SourceLocation const& _location, SecondarySourceLocation const& _secondLocation, std::string const& _description); void docstringParsingError(std::string const& _description); @@ -123,6 +124,12 @@ private: SecondarySourceLocation const& _secondaryLocation, std::string const& _description = std::string()); + void fatalError( + Error::Type _type, + SourceLocation const& _location, + SecondarySourceLocation const& _secondaryLocation, + std::string const& _description = std::string()); + void fatalError(Error::Type _type, SourceLocation const& _location = SourceLocation(), std::string const& _description = std::string());