aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2013-06-02 13:47:19 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2014-02-15 15:21:54 +0100
commit8046e11445ba71b767d4fde08ce1e43e0dcd0359 (patch)
treed6991bb858a91336e76831b8dbd39c28345f21a9 /src/parser.cpp
parent78ad52e40992d6e68238dc1574d4ae6c6f922d27 (diff)
downloadsciteco-8046e11445ba71b767d4fde08ce1e43e0dcd0359.tar.gz
use GLib's GError information to yield errors
* results in better error messages, e.g. when opening files * the case that a file to be opened (EB) exists but is not readably is handled for the first time
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 4dbec88..aed9348 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -177,10 +177,11 @@ Execute::macro(const gchar *macro, bool locals)
void
Execute::file(const gchar *filename, bool locals)
{
+ GError *gerror = NULL;
gchar *macro_str, *p;
- if (!g_file_get_contents(filename, &macro_str, NULL, NULL))
- throw State::Error("Error reading file \"%s\"", filename);
+ if (!g_file_get_contents(filename, &macro_str, NULL, &gerror))
+ throw State::GError(gerror);
/* only when executing files, ignore Hash-Bang line */
if (*macro_str == '#')
p = MAX(strchr(macro_str, '\r'), strchr(macro_str, '\n'))+1;