From 3bc793d95293d40dbab62c593ce4ceaa86fae25b Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Thu, 29 May 2014 13:26:37 +0200 Subject: Improved TransformationFacade error handling * ErrorHandler class created in 5859cb6 now caches all errors instead of pushing them to std::cerr ** cached errors are retrieved by TransformationFacade's "generate" member method * test frontend pushes all errors to std::cerr * FunctionTransform returns errors to the calling template as XML ** FunctionTransform test case demonstrates how one may test for successful transformation * "generate" member method returns std::string vector wrapped in a std::unique_ptr ** this is used as a kind of optional pointer, as the std::unique_ptr instance only wraps a vector if errors where actually generated --- test.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'test.cc') diff --git a/test.cc b/test.cc index 9d1dd3a..0c5e4b2 100644 --- a/test.cc +++ b/test.cc @@ -48,12 +48,20 @@ int main(int ac, char** av) { plattform.getEntityResolver() ); + InputXSLT::TransformationFacade::return_type errors{}; + if ( variables.count("target") ) { - return transformation.generate( + errors = transformation.generate( variables["target"].as() ); } else { - return transformation.generate(std::cout); + errors = transformation.generate(std::cout); + } + + if ( errors ) { + for ( auto&& error : *errors ) { + std::cerr << error << std::endl; + } } } else { std::cout << optionDescription << std::endl; -- cgit v1.2.3