From 557269660c1d9796a7cf9e911efb9262f645e359 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 22 Nov 2016 12:10:03 +0200 Subject: Use diagnostics facility from libbutl --- build2/test/script/parser.cxx | 21 ++++++++------------- build2/test/script/runner.cxx | 3 +-- 2 files changed, 9 insertions(+), 15 deletions(-) (limited to 'build2/test/script') diff --git a/build2/test/script/parser.cxx b/build2/test/script/parser.cxx index 438e1f2..5730647 100644 --- a/build2/test/script/parser.cxx +++ b/build2/test/script/parser.cxx @@ -47,8 +47,8 @@ namespace build2 } catch (const io_error& e) { - error << "unable to read testscript " << p << ": " << e.what (); - throw failed (); + fail << "unable to read testscript " << p << ": " << e.what () + << endf; } } @@ -986,11 +986,9 @@ namespace build2 } catch (const invalid_path&) {} // Fall through. - { - diag_record dr (fail (dl)); - dr << "invalid testscript include path "; - to_stream (dr.os, n, true); // Quote. - } + diag_record dr (fail (dl)); + dr << "invalid testscript include path "; + to_stream (dr.os, n, true); // Quote. } } @@ -1311,14 +1309,12 @@ namespace build2 return p; } - error (l) << "empty " << what; + fail (l) << "empty " << what << endf; } catch (const invalid_path& e) { - error (l) << "invalid " << what << " '" << e.path << "'"; + fail (l) << "invalid " << what << " '" << e.path << "'" << endf; } - - throw failed (); }; auto add_file = [&app, &parse_path] (redirect& r, int fd, string&& w) @@ -2630,8 +2626,7 @@ namespace build2 } catch (const exception&) { - error (loc) << "invalid $* index " << var.name; - throw failed (); + fail (loc) << "invalid $* index " << var.name << endf; } const strings& s (cast (v)); diff --git a/build2/test/script/runner.cxx b/build2/test/script/runner.cxx index aa35612..ef086f5 100644 --- a/build2/test/script/runner.cxx +++ b/build2/test/script/runner.cxx @@ -41,8 +41,7 @@ namespace build2 // executed let's add the location anyway to ease the // troubleshooting. And let's stick to that principle down the road. // - error (ll) << "unable to read " << p << ": " << e.what (); - throw failed (); + fail (ll) << "unable to read " << p << ": " << e.what () << endf; } } -- cgit v1.1