From 9fcb91ca456bae8cd5e64cc98ce66283bc3c8405 Mon Sep 17 00:00:00 2001
From: Gareth Tribello <gareth.tribello@gmail.com>
Date: Thu, 26 Jan 2012 10:16:16 +0100
Subject: [PATCH] Added error and warning routines that give the same error
 message every time

---
 src/Action.cpp | 10 ++++++++++
 src/Action.h   |  6 ++++++
 2 files changed, 16 insertions(+)

diff --git a/src/Action.cpp b/src/Action.cpp
index df2074684..fc52eb390 100644
--- a/src/Action.cpp
+++ b/src/Action.cpp
@@ -150,6 +150,16 @@ void Action::prepare(){
   return;
 }
 
+void Action::error( const std::string msg ){
+  log.printf("ERROR in input to action %s with label %s : %s \n \n", name.c_str(), label.c_str(), msg.c_str() );
+  keywords.print( log );
+  this->exit(1);
+}
+
+void Action::warning( const std::string msg ){
+  log.printf("WARNING for action %s with label %s : %s \n", name.c_str(), label.c_str(), msg.c_str() ); 
+}
+
 
 
 
diff --git a/src/Action.h b/src/Action.h
index 8fbebc7b6..09f6ddb29 100644
--- a/src/Action.h
+++ b/src/Action.h
@@ -94,6 +94,12 @@ protected:
 /// Parse one keyword as boolean flag
   void parseFlag(const std::string&key,bool&t);
 
+/// Crash calculation and print documentation
+  void error( const std::string msg ); 
+  
+/// Issue a warning
+  void warning( const std::string msg );
+
 /// Exit with error code c
   void exit(int c=0);
 
-- 
GitLab