From bf6709add1b442f511833a7a3d887690201fe4f0 Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Wed, 14 Dec 2016 18:40:48 +0000 Subject: [PATCH] Rethrow RepresentationException without mark info When closing the editor, the metadata is saved as YAML, but the user doesn't see it, so providing line and column info is pointless and confusing. --- src/gui/query/editor_closed_query.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/gui/query/editor_closed_query.h b/src/gui/query/editor_closed_query.h index 320a3487..078775e0 100644 --- a/src/gui/query/editor_closed_query.h +++ b/src/gui/query/editor_closed_query.h @@ -41,16 +41,9 @@ public: state_.decrementUnappliedChangeCounter(); return json; - } catch (std::exception& e) { - // If this was a YAML conversion error, cut off the line and column numbers, - // since the YAML wasn't written to a file. - std::string error = e.what(); - size_t pos = std::string::npos; - if ((pos = error.find("bad conversion")) != std::string::npos) { - error = error.substr(pos); - } - - throw std::runtime_error(error); + } catch (YAML::RepresentationException& e) { + BOOST_LOG_TRIVIAL(error) << "Error while closing editor: " << e.what(); + throw YAML::RepresentationException(YAML::Mark::null_mark(), e.msg); } }