summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-09-22 17:12:28 +0200
committerCarl Hetherington <cth@carlh.net>2024-09-22 17:12:28 +0200
commitdb6882af015dc067baed605b11d8dfa3c3dcb7e3 (patch)
treee79368a92f71ac572a09be28969dd5265eeed88d
parent6202999dc59f90cb5a0f51f306af5b744af2301b (diff)
Throw a more useful error when the disk is full during an export (#2866).v2.17.21
-rw-r--r--src/lib/exceptions.cc7
-rw-r--r--src/lib/exceptions.h7
-rw-r--r--src/lib/ffmpeg_file_encoder.cc6
3 files changed, 19 insertions, 1 deletions
diff --git a/src/lib/exceptions.cc b/src/lib/exceptions.cc
index a51842b80..27496dcdc 100644
--- a/src/lib/exceptions.cc
+++ b/src/lib/exceptions.cc
@@ -173,3 +173,10 @@ VerifyError::VerifyError (string m, int n)
}
+
+DiskFullError::DiskFullError(boost::filesystem::path writing)
+ : std::runtime_error(String::compose(_("Disk full when writing %1"), writing.string()))
+{
+
+}
+
diff --git a/src/lib/exceptions.h b/src/lib/exceptions.h
index e08392689..3069d792e 100644
--- a/src/lib/exceptions.h
+++ b/src/lib/exceptions.h
@@ -535,4 +535,11 @@ private:
};
+class DiskFullError : public std::runtime_error
+{
+public:
+ explicit DiskFullError(boost::filesystem::path writing);
+};
+
+
#endif
diff --git a/src/lib/ffmpeg_file_encoder.cc b/src/lib/ffmpeg_file_encoder.cc
index 147e83a65..7f74ae4f6 100644
--- a/src/lib/ffmpeg_file_encoder.cc
+++ b/src/lib/ffmpeg_file_encoder.cc
@@ -404,7 +404,11 @@ FFmpegFileEncoder::flush ()
auto const r = av_write_trailer(_format_context);
if (r) {
- throw EncodeError(N_("av_write_trailer"), N_("FFmpegFileEncoder::flush"), r);
+ if (r == -ENOSPC) {
+ throw DiskFullError(_output);
+ } else {
+ throw EncodeError(N_("av_write_trailer"), N_("FFmpegFileEncoder::flush"), r);
+ }
}
}