From b7335b8c1425138601698f2deac8e471b371cbcc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 19 Sep 2011 16:47:07 +0200 Subject: Throw exception instead of returning false to indicate validation failure This is consistent with what's done in processor and generator. --- odb/plugin.cxx | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) (limited to 'odb/plugin.cxx') diff --git a/odb/plugin.cxx b/odb/plugin.cxx index 7f01478..fbf1fa0 100644 --- a/odb/plugin.cxx +++ b/odb/plugin.cxx @@ -112,36 +112,22 @@ gate_callback (void*, void*) // Validate, pass 1. // - { - validator v; - if (!v.validate (*options_, *u, file_, 1)) - r = 1; - } + validator v; + v.validate (*options_, *u, file_, 1); // Process. // - if (r == 0) - { - processor p; - p.process (*options_, *u, file_); - } + processor pr; + pr.process (*options_, *u, file_); // Validate, pass 2. // - if (r == 0) - { - validator v; - if (!v.validate (*options_, *u, file_, 2)) - r = 1; - } + v.validate (*options_, *u, file_, 2); // Generate. // - if (r == 0) - { - generator g; - g.generate (*options_, *u, file_); - } + generator g; + g.generate (*options_, *u, file_); } catch (parser::failed const&) { @@ -149,6 +135,12 @@ gate_callback (void*, void*) // r = 1; } + catch (validator::failed const&) + { + // Diagnostics has aready been issued. + // + r = 1; + } catch (processor::failed const&) { // Diagnostics has aready been issued. -- cgit v1.1