+-------------------------------------------------------------------
+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
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;
};
}
{
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");