Rename send_binary -> write_to_socket.
[dcpomatic.git] / src / lib / exceptions.cc
index 99d4c3979a602dc5e1a84c0673e29c10c1e9d4e5..3991c57b97ab98608ed280d02d581827fecdfae5 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -25,6 +25,7 @@
 
 using std::string;
 using std::runtime_error;
+using boost::optional;
 
 /** @param f File that we were trying to open */
 OpenFileError::OpenFileError (boost::filesystem::path f, int error, Mode mode)
@@ -40,6 +41,13 @@ OpenFileError::OpenFileError (boost::filesystem::path f, int error, Mode mode)
 
 }
 
+FileNotFoundError::FileNotFoundError (boost::filesystem::path f)
+       : runtime_error(String::compose("File %1 not found", f.string()))
+       , _file (f)
+{
+
+}
+
 ReadFileError::ReadFileError (boost::filesystem::path f, int e)
        : FileError (String::compose (_("could not read from file %1 (%2)"), f.string(), strerror (e)), f)
 {
@@ -107,3 +115,26 @@ GLError::GLError (char const * last, int e)
 {
 
 }
+
+CopyError::CopyError (string m, optional<int> n)
+       : runtime_error (String::compose("%1%2", m, n ? String::compose(" (%1)", *n) : ""))
+       , _message (m)
+       , _number (n)
+{
+
+}
+
+CommunicationFailedError::CommunicationFailedError ()
+       : CopyError (_("Lost communication between main and writer processes"))
+{
+
+}
+
+VerifyError::VerifyError (string m, int n)
+       : runtime_error (String::compose("%1 (%2)", m, n))
+       , _message (m)
+       , _number (n)
+{
+
+}
+