diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2013-06-02 13:47:19 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2014-02-15 15:21:54 +0100 |
commit | 8046e11445ba71b767d4fde08ce1e43e0dcd0359 (patch) | |
tree | d6991bb858a91336e76831b8dbd39c28345f21a9 /src/ring.cpp | |
parent | 78ad52e40992d6e68238dc1574d4ae6c6f922d27 (diff) | |
download | sciteco-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/ring.cpp')
-rw-r--r-- | src/ring.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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 |