From 8046e11445ba71b767d4fde08ce1e43e0dcd0359 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 2 Jun 2013 13:47:19 +0200 Subject: 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 --- src/ring.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ring.cpp') diff --git a/src/ring.cpp b/src/ring.cpp index 134bf63..a649a0d 100644 --- a/src/ring.cpp +++ b/src/ring.cpp @@ -125,14 +125,16 @@ Buffer::UndoTokenClose::run(void) * 2.) On other platforms read into and copy from a statically sized buffer * (perhaps page-sized) */ -bool +void Buffer::load(const gchar *filename) { gchar *contents; gsize size; - if (!g_file_get_contents(filename, &contents, &size, NULL)) - return false; + GError *gerror = NULL; + + if (!g_file_get_contents(filename, &contents, &size, &gerror)) + throw State::GError(gerror); edit(); @@ -151,8 +153,6 @@ Buffer::load(const gchar *filename) #endif set_filename(filename); - - return true; } void -- cgit v1.2.3