]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- improved error message (see bsc#956606) 215/head
authorArvin Schnell <aschnell@suse.de>
Fri, 18 Dec 2015 14:42:50 +0000 (15:42 +0100)
committerArvin Schnell <aschnell@suse.de>
Fri, 18 Dec 2015 14:42:50 +0000 (15:42 +0100)
package/snapper.changes
snapper/AppUtil.h
snapper/Btrfs.cc

index d0b8e1c47d7a679c7b67cb4834e8b682d8cb20a8..93024e5ebe936e43eff0f4b0fdef5f04a476d1e7 100644 (file)
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Fri Dec 18 15:41:16 CET 2015 - aschnell@suse.com
+
+- improved error message (see bsc#956606)
+
 -------------------------------------------------------------------
 Mon Dec 14 16:25:32 UTC 2015 - lslezak@suse.cz
 
index c735a9df3c6273203a54abdd995066e486e69013..d2211e7760fca76c2c0b0152672d35ed3719b5ad 100644 (file)
@@ -116,10 +116,13 @@ namespace snapper
 
     struct runtime_error_with_errno : public std::runtime_error
     {
-       explicit runtime_error_with_errno(const char* what_arg, int errnum)
-           : runtime_error(sformat("%s, errno:%d (%s)", what_arg, errnum,
-                                   stringerror(errnum).c_str()))
+       explicit runtime_error_with_errno(const char* what_arg, int error_number)
+           : runtime_error(sformat("%s, errno:%d (%s)", what_arg, error_number,
+                                   stringerror(error_number).c_str())),
+             error_number(error_number)
        {}
+
+       const int error_number;
     };
 
 }
index 9c222356eb842be833955b5151f95c0ddf491211..7029e66cbfd40889f5dbbefa35efbe8d1dbee36c 100644 (file)
@@ -108,10 +108,19 @@ namespace snapper
        {
            create_subvolume(subvolume_dir.fd(), ".snapshots");
        }
-       catch (const runtime_error& e)
+       catch (const runtime_error_with_errno& e)
        {
            y2err("create subvolume failed, " << e.what());
-           throw CreateConfigFailedException("creating btrfs snapshot failed");
+
+           switch (e.error_number)
+           {
+               case EEXIST:
+                   throw CreateConfigFailedException("creating btrfs subvolume .snapshots failed "
+                                                     "since it already exists");
+
+               default:
+                   throw CreateConfigFailedException("creating btrfs subvolume .snapshots failed");
+           }
        }
 
        SFile x(subvolume_dir, ".snapshots");