aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-09-15 16:26:23 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-09-16 13:03:13 +0300
commit8b69cab7c802a0d0bd9cc90da33002dd5f86042f (patch)
treeb7bc7c020ffb440b5b8f203ed4a91d9f0f5793a2
parent564801acd608513adb07244829735ffb2669685d (diff)
Add io_error alias for std::ios_base::failure
-rw-r--r--bpkg/archive.cxx2
-rw-r--r--bpkg/auth.cxx17
-rw-r--r--bpkg/cfg-create.cxx6
-rw-r--r--bpkg/checksum.cxx10
-rw-r--r--bpkg/fetch.cxx10
-rw-r--r--bpkg/help.cxx4
-rw-r--r--bpkg/pkg-verify.cxx4
-rw-r--r--bpkg/rep-create.cxx3
-rw-r--r--bpkg/rep-info.cxx2
-rw-r--r--bpkg/satisfaction.cxx2
-rw-r--r--bpkg/types2
11 files changed, 31 insertions, 31 deletions
diff --git a/bpkg/archive.cxx b/bpkg/archive.cxx
index 7bc4740..e3b5f8b 100644
--- a/bpkg/archive.cxx
+++ b/bpkg/archive.cxx
@@ -110,7 +110,7 @@ namespace bpkg
// Fall through.
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
// Child exit status doesn't matter. Just wait for the process
// completion and fall through.
diff --git a/bpkg/auth.cxx b/bpkg/auth.cxx
index 6ef9751..75cdb45 100644
--- a/bpkg/auth.cxx
+++ b/bpkg/auth.cxx
@@ -4,7 +4,6 @@
#include <bpkg/auth>
-#include <ios>
#include <ratio>
#include <limits> // numeric_limits
#include <cstring> // strlen(), strcmp()
@@ -131,7 +130,7 @@ namespace bpkg
const size_t n (19);
if (!(s.size () > n && s.compare (0, n, "SHA256 Fingerprint=") == 0))
- throw ifdstream::failure ("");
+ throw io_error ("");
string fp;
@@ -141,7 +140,7 @@ namespace bpkg
}
catch (const invalid_argument&)
{
- throw ifdstream::failure ("");
+ throw io_error ("");
}
if (pr.wait ())
@@ -150,7 +149,7 @@ namespace bpkg
// Fall through.
//
}
- catch (const ios_base::failure&)
+ catch (const io_error&)
{
// Child exit status doesn't matter. Just wait for the process
// completion and fall through.
@@ -407,7 +406,7 @@ namespace bpkg
// Fall through.
//
}
- catch (const ios_base::failure&)
+ catch (const io_error&)
{
// Child exit status doesn't matter. Just wait for the process
// completion and fall through.
@@ -555,7 +554,7 @@ namespace bpkg
ofs << *pem;
ofs.close ();
}
- catch (const ofdstream::failure& e)
+ catch (const io_error& e)
{
fail << "unable to write certificate to " << f << ": " << e.what ();
}
@@ -641,7 +640,7 @@ namespace bpkg
ofs << *cert_pem;
ofs.close ();
}
- catch (const ofdstream::failure& e)
+ catch (const io_error& e)
{
fail << "unable to save certificate to temporary file " << f
<< ": " << e.what ();
@@ -713,7 +712,7 @@ namespace bpkg
// Fall through.
//
}
- catch (const ios_base::failure&)
+ catch (const io_error&)
{
// Child exit status doesn't matter. Just wait for the process
// completion and fall through.
@@ -794,7 +793,7 @@ namespace bpkg
// Fall through.
//
}
- catch (const iostream::failure&)
+ catch (const io_error&)
{
// Child exit status doesn't matter. Just wait for the process
// completion and fall through.
diff --git a/bpkg/cfg-create.cxx b/bpkg/cfg-create.cxx
index 1d8171f..2c8bd0a 100644
--- a/bpkg/cfg-create.cxx
+++ b/bpkg/cfg-create.cxx
@@ -104,7 +104,7 @@ namespace bpkg
ofs.close ();
}
- catch (const ofdstream::failure& e)
+ catch (const io_error& e)
{
fail << "unable to write to " << f << ": " << e.what ();
}
@@ -135,7 +135,7 @@ namespace bpkg
ofs.close ();
}
- catch (const ofdstream::failure& e)
+ catch (const io_error& e)
{
fail << "unable to write to " << f << ": " << e.what ();
}
@@ -154,7 +154,7 @@ namespace bpkg
ofs.close ();
}
- catch (const ofdstream::failure& e)
+ catch (const io_error& e)
{
fail << "unable to write to " << f << ": " << e.what ();
}
diff --git a/bpkg/checksum.cxx b/bpkg/checksum.cxx
index 3f52204..8940952 100644
--- a/bpkg/checksum.cxx
+++ b/bpkg/checksum.cxx
@@ -48,7 +48,7 @@ namespace bpkg
l ==
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
// Fall through.
}
@@ -110,7 +110,7 @@ namespace bpkg
return pr.wait () && l.compare (0, 9, "sha256sum") == 0;
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
// Fall through.
}
@@ -172,7 +172,7 @@ namespace bpkg
return pr.wait () && l.size () != 0 && l[0] >= '0' && l[0] <= '9';
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
// Fall through.
}
@@ -359,7 +359,7 @@ namespace bpkg
// Ignore these exceptions if the child process exited with an error status
// since that's the source of the failure.
//
- catch (const iostream::failure&)
+ catch (const io_error&)
{
if (pr.wait ())
fail << "unable to read/write '" << sha256_path << "' output/input";
@@ -411,7 +411,7 @@ namespace bpkg
ifdstream ifs (f, ios::binary);
return sha256 (o, ifs);
}
- catch (const iostream::failure& e)
+ catch (const io_error& e)
{
error << "unable read " << f << ": " << e.what ();
throw failed ();
diff --git a/bpkg/fetch.cxx b/bpkg/fetch.cxx
index 734c261..33753fb 100644
--- a/bpkg/fetch.cxx
+++ b/bpkg/fetch.cxx
@@ -55,7 +55,7 @@ namespace bpkg
if (!(pr.wait () && l.compare (0, 9, "GNU Wget ") == 0))
return false;
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
return false;
}
@@ -195,7 +195,7 @@ namespace bpkg
return pr.wait () && l.compare (0, 5, "curl ") == 0;
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
// Fall through.
}
@@ -306,7 +306,7 @@ namespace bpkg
return l.compare (0, 13, "usage: fetch ") == 0;
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
// Fall through.
}
@@ -608,7 +608,7 @@ namespace bpkg
if (pr.wait ())
fail (e.name, e.line, e.column) << e.description;
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
if (pr.wait ())
fail << "unable to read fetched " << url;
@@ -673,7 +673,7 @@ namespace bpkg
{
error (e.name, e.line, e.column) << e.description;
}
- catch (const ifdstream::failure& e)
+ catch (const io_error& e)
{
error << "unable to read from " << f << ": " << e.what ();
}
diff --git a/bpkg/help.cxx b/bpkg/help.cxx
index 3d5efb8..92253bd 100644
--- a/bpkg/help.cxx
+++ b/bpkg/help.cxx
@@ -50,8 +50,8 @@ namespace bpkg
//
return p.wait () ? 0 : 1;
}
- // Catch ios_base::failure as std::system_error together with the
- // pager-specific exceptions.
+ // Catch io_error as std::system_error together with the pager-specific
+ // exceptions.
//
catch (const system_error& e)
{
diff --git a/bpkg/pkg-verify.cxx b/bpkg/pkg-verify.cxx
index ea072d9..1423d82 100644
--- a/bpkg/pkg-verify.cxx
+++ b/bpkg/pkg-verify.cxx
@@ -78,7 +78,7 @@ namespace bpkg
throw failed ();
}
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
if (pr.wait ())
{
@@ -157,7 +157,7 @@ namespace bpkg
throw failed ();
}
- catch (const ifdstream::failure& e)
+ catch (const io_error& e)
{
if (diag)
error << "unable to read from " << mf << ": " << e.what ();
diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx
index 2d682f8..da44d3b 100644
--- a/bpkg/rep-create.cxx
+++ b/bpkg/rep-create.cxx
@@ -5,7 +5,6 @@
#include <bpkg/rep-create>
#include <map>
-#include <iostream>
#include <butl/fdstream>
#include <butl/filesystem> // dir_iterator
@@ -263,7 +262,7 @@ namespace bpkg
{
fail << "unable to save manifest: " << e.description;
}
- catch (const ofdstream::failure& e)
+ catch (const io_error& e)
{
fail << "unable to write to " << p << ": " << e.what ();
}
diff --git a/bpkg/rep-info.cxx b/bpkg/rep-info.cxx
index cdad96b..355d8b8 100644
--- a/bpkg/rep-info.cxx
+++ b/bpkg/rep-info.cxx
@@ -242,7 +242,7 @@ namespace bpkg
{
fail << "unable to serialize manifest: " << e.description;
}
- catch (const ostream::failure&)
+ catch (const io_error&)
{
fail << "unable to write to STDOUT";
}
diff --git a/bpkg/satisfaction.cxx b/bpkg/satisfaction.cxx
index 2e2b269..23c63fd 100644
--- a/bpkg/satisfaction.cxx
+++ b/bpkg/satisfaction.cxx
@@ -141,7 +141,7 @@ namespace bpkg
// Fall through.
}
- catch (const ifdstream::failure&)
+ catch (const io_error&)
{
pr.wait ();
// Fall through.
diff --git a/bpkg/types b/bpkg/types
index 2e03675..8bff6bb 100644
--- a/bpkg/types
+++ b/bpkg/types
@@ -15,6 +15,7 @@
#include <ostream>
#include <functional> // function, reference_wrapper
+#include <ios> // ios_base::failure
#include <exception> // exception
#include <stdexcept> // logic_error, invalid_argument, runtime_error
#include <system_error>
@@ -60,6 +61,7 @@ namespace bpkg
using std::invalid_argument;
using std::runtime_error;
using std::system_error;
+ using io_error = std::ios_base::failure;
// <butl/optional>
//