From 8ed2ab6260defd9f0459d0533c324e29ccd117d6 Mon Sep 17 00:00:00 2001
From: Thomas Moulard <thomas.moulard@gmail.com>
Date: Wed, 29 Dec 2010 01:18:23 +0100
Subject: [PATCH] Enhance run command error message.

---
 src/dgraph/interpreter.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/dgraph/interpreter.cpp b/src/dgraph/interpreter.cpp
index 5ae153d..a59bb31 100644
--- a/src/dgraph/interpreter.cpp
+++ b/src/dgraph/interpreter.cpp
@@ -22,6 +22,8 @@
 /* --- INCLUDE --------------------------------------------------------- */
 /* --------------------------------------------------------------------- */
 
+#include <boost/format.hpp>
+
 /* DYNAMIC-GRAPH */
 #include <dynamic-graph/interpreter.h>
 #include <dynamic-graph/plugin-loader.h>
@@ -285,9 +287,10 @@ cmdRun( const std::string& cmdLine, std::istringstream& cmdArg, std::ostream& os
   ifstream script( filename.c_str(),ios::in );
   if(! script.is_open() )
     {
-      DG_THROW ExceptionFactory( ExceptionFactory::READ_FILE,
-				     "File is not open."," (while reading <%s>).",
-				     filename.c_str() );
+      boost::format fmt
+	("failed to run file ``%1%'' (file does not exist or is not readable).");
+      fmt % filename;
+      DG_THROW ExceptionFactory (ExceptionFactory::READ_FILE, fmt.str ());
     }
 
   const int SIZE = 16384;
-- 
GitLab