From 64f84951d0e5c1d3352ba7b9f6c894eac72424c8 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 6 Jan 2017 03:23:55 +0300 Subject: Make use of operator<<(ostream, exception) --- bpkg/archive.cxx | 5 ++--- bpkg/auth.cxx | 17 ++++++++--------- bpkg/bpkg.cxx | 2 +- bpkg/cfg-create.cxx | 6 +++--- bpkg/checksum.cxx | 4 ++-- bpkg/fetch.cxx | 6 +++--- bpkg/help.cxx | 2 +- bpkg/manifest-utility.cxx | 4 ++-- bpkg/openssl.cxx | 2 +- bpkg/pkg-unpack.cxx | 2 +- bpkg/pkg-verify.cxx | 6 +++--- bpkg/rep-create.cxx | 4 ++-- bpkg/rep-fetch.cxx | 2 +- bpkg/satisfaction.cxx | 2 +- bpkg/utility.cxx | 16 ++++++++-------- 15 files changed, 39 insertions(+), 41 deletions(-) diff --git a/bpkg/archive.cxx b/bpkg/archive.cxx index fb7956d..3961aba 100644 --- a/bpkg/archive.cxx +++ b/bpkg/archive.cxx @@ -78,7 +78,7 @@ namespace bpkg } catch (const process_error& e) { - error << "unable to execute " << args[0] << ": " << e.what (); + error << "unable to execute " << args[0] << ": " << e; if (e.child ()) exit (1); @@ -126,7 +126,6 @@ namespace bpkg } catch (const process_error& e) { - fail << "unable to extract " << f << " from " << a << ": " << e.what () - << endf; + fail << "unable to extract " << f << " from " << a << ": " << e << endf; } } diff --git a/bpkg/auth.cxx b/bpkg/auth.cxx index b736dd6..da5b293 100644 --- a/bpkg/auth.cxx +++ b/bpkg/auth.cxx @@ -165,7 +165,7 @@ namespace bpkg catch (const process_error& e) { error << "unable to calculate certificate fingerprint for " - << rl.canonical_name () << ": " << e.what (); + << rl.canonical_name () << ": " << e; // Fall through. } @@ -420,8 +420,7 @@ namespace bpkg // parsing diagnostics since we were probably parsing garbage. // if (pr.wait ()) - fail << "invalid certificate for " << repo << ": " << e.what () - << endf; + fail << "invalid certificate for " << repo << ": " << e << endf; // Fall through. } @@ -432,7 +431,7 @@ namespace bpkg } catch (const process_error& e) { - error << "unable to parse certificate for " << repo << ": " << e.what (); + error << "unable to parse certificate for " << repo << ": " << e; // Fall through. } @@ -555,7 +554,7 @@ namespace bpkg } catch (const io_error& e) { - fail << "unable to write certificate to " << f << ": " << e.what (); + fail << "unable to write certificate to " << f << ": " << e; } } @@ -642,11 +641,11 @@ namespace bpkg catch (const io_error& e) { fail << "unable to save certificate to temporary file " << f - << ": " << e.what (); + << ": " << e; } catch (const system_error& e) { - fail << "unable to obtain temporary file: " << e.what (); + fail << "unable to obtain temporary file: " << e; } } else @@ -726,7 +725,7 @@ namespace bpkg catch (const process_error& e) { error << "unable to authenticate repository " - << rl.canonical_name () << ": " << e.what (); + << rl.canonical_name () << ": " << e; // Fall through. } @@ -807,7 +806,7 @@ namespace bpkg } catch (const process_error& e) { - error << "unable to sign repository " << r << ": " << e.what (); + error << "unable to sign repository " << r << ": " << e; // Fall through. } diff --git a/bpkg/bpkg.cxx b/bpkg/bpkg.cxx index beecfc8..ffdc9c2 100644 --- a/bpkg/bpkg.cxx +++ b/bpkg/bpkg.cxx @@ -303,7 +303,7 @@ catch (const cli::exception& e) /* catch (const std::exception& e) { - error << e.what (); + error << e; return 1; } */ diff --git a/bpkg/cfg-create.cxx b/bpkg/cfg-create.cxx index 488d22e..b3d672b 100644 --- a/bpkg/cfg-create.cxx +++ b/bpkg/cfg-create.cxx @@ -106,7 +106,7 @@ namespace bpkg } catch (const io_error& e) { - fail << "unable to write to " << f << ": " << e.what (); + fail << "unable to write to " << f << ": " << e; } // Write build/root.build. @@ -137,7 +137,7 @@ namespace bpkg } catch (const io_error& e) { - fail << "unable to write to " << f << ": " << e.what (); + fail << "unable to write to " << f << ": " << e; } // Write root buildfile. @@ -156,7 +156,7 @@ namespace bpkg } catch (const io_error& e) { - fail << "unable to write to " << f << ": " << e.what (); + fail << "unable to write to " << f << ": " << e; } // Configure. diff --git a/bpkg/checksum.cxx b/bpkg/checksum.cxx index d0424dc..75f1375 100644 --- a/bpkg/checksum.cxx +++ b/bpkg/checksum.cxx @@ -323,7 +323,7 @@ namespace bpkg } catch (const process_error& e) { - error << "unable to execute " << sha256_path << ": " << e.what (); + error << "unable to execute " << sha256_path << ": " << e; if (e.child ()) exit (1); @@ -423,7 +423,7 @@ namespace bpkg } catch (const io_error& e) { - fail << "unable read " << f << ": " << e.what () << endf; + fail << "unable read " << f << ": " << e << endf; } } } diff --git a/bpkg/fetch.cxx b/bpkg/fetch.cxx index 978d61c..8a33f07 100644 --- a/bpkg/fetch.cxx +++ b/bpkg/fetch.cxx @@ -498,7 +498,7 @@ namespace bpkg } catch (const process_error& e) { - error << "unable to execute " << fetch_path << ": " << e.what (); + error << "unable to execute " << fetch_path << ": " << e; if (e.child ()) exit (1); @@ -647,7 +647,7 @@ namespace bpkg } catch (const system_error& e) { - fail << "unable to copy " << f << " to " << r << ": " << e.what (); + fail << "unable to copy " << f << " to " << r << ": " << e; } return r; @@ -685,7 +685,7 @@ namespace bpkg } catch (const io_error& e) { - fail << "unable to read from " << f << ": " << e.what () << endf; + fail << "unable to read from " << f << ": " << e << endf; } } diff --git a/bpkg/help.cxx b/bpkg/help.cxx index 53f59ca..133c08e 100644 --- a/bpkg/help.cxx +++ b/bpkg/help.cxx @@ -55,7 +55,7 @@ namespace bpkg // catch (const system_error& e) { - error << "pager failed: " << e.what (); + error << "pager failed: " << e; // Fall through. } diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx index 901655b..c8fb6e9 100644 --- a/bpkg/manifest-utility.cxx +++ b/bpkg/manifest-utility.cxx @@ -57,7 +57,7 @@ namespace bpkg } catch (const invalid_argument& e) { - fail << "invalid package version '" << p << "': " << e.what (); + fail << "invalid package version '" << p << "': " << e; } } @@ -78,6 +78,6 @@ namespace bpkg } catch (const invalid_argument& e) { - fail << "invalid repository location '" << s << "': " << e.what () << endf; + fail << "invalid repository location '" << s << "': " << e << endf; } } diff --git a/bpkg/openssl.cxx b/bpkg/openssl.cxx index d4ac747..3268cf8 100644 --- a/bpkg/openssl.cxx +++ b/bpkg/openssl.cxx @@ -49,7 +49,7 @@ namespace bpkg } catch (const process_error& e) { - error << "unable to execute " << args[0] << ": " << e.what (); + error << "unable to execute " << args[0] << ": " << e; if (e.child ()) exit (1); diff --git a/bpkg/pkg-unpack.cxx b/bpkg/pkg-unpack.cxx index 29e765b..2d9475e 100644 --- a/bpkg/pkg-unpack.cxx +++ b/bpkg/pkg-unpack.cxx @@ -206,7 +206,7 @@ namespace bpkg } catch (const process_error& e) { - error << "unable to execute " << args[0] << ": " << e.what (); + error << "unable to execute " << args[0] << ": " << e; if (e.child ()) exit (1); diff --git a/bpkg/pkg-verify.cxx b/bpkg/pkg-verify.cxx index e214654..cd51d54 100644 --- a/bpkg/pkg-verify.cxx +++ b/bpkg/pkg-verify.cxx @@ -106,8 +106,8 @@ namespace bpkg { // Note: this is not an "invalid package" case, so no diag check. // - fail << "unable to extract manifest file from " << af << ": " - << e.what () << endf; + fail << "unable to extract manifest file from " << af << ": " << e + << endf; } package_manifest @@ -158,7 +158,7 @@ namespace bpkg catch (const io_error& e) { if (diag) - error << "unable to read from " << mf << ": " << e.what (); + error << "unable to read from " << mf << ": " << e; throw failed (); } diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx index eb91c2b..1762c31 100644 --- a/bpkg/rep-create.cxx +++ b/bpkg/rep-create.cxx @@ -167,7 +167,7 @@ namespace bpkg } catch (const system_error& e) { - fail << "unable to scan directory " << d << ": " << e.what () << endf; + fail << "unable to scan directory " << d << ": " << e << endf; } int @@ -263,7 +263,7 @@ namespace bpkg } catch (const io_error& e) { - fail << "unable to write to " << p << ": " << e.what (); + fail << "unable to write to " << p << ": " << e; } if (verb) diff --git a/bpkg/rep-fetch.cxx b/bpkg/rep-fetch.cxx index 996b604..35bfb1a 100644 --- a/bpkg/rep-fetch.cxx +++ b/bpkg/rep-fetch.cxx @@ -119,7 +119,7 @@ namespace bpkg catch (const invalid_argument& e) { fail << "invalid relative repository location '" << rm.location - << "': " << e.what () << + << "': " << e << info << "base repository location is " << rl; } } diff --git a/bpkg/satisfaction.cxx b/bpkg/satisfaction.cxx index 4e707dd..7c1541a 100644 --- a/bpkg/satisfaction.cxx +++ b/bpkg/satisfaction.cxx @@ -152,7 +152,7 @@ namespace bpkg } catch (const process_error& e) { - error << "unable to execute " << args[0] << ": " << e.what (); + error << "unable to execute " << args[0] << ": " << e; if (e.child ()) exit (1); diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx index 15c4728..234304e 100644 --- a/bpkg/utility.cxx +++ b/bpkg/utility.cxx @@ -68,7 +68,7 @@ namespace bpkg } catch (const system_error& e) { - fail << "unable to stat path " << f << ": " << e.what () << endf; + fail << "unable to stat path " << f << ": " << e << endf; } } @@ -81,7 +81,7 @@ namespace bpkg } catch (const system_error& e) { - fail << "unable to stat path " << d << ": " << e.what () << endf; + fail << "unable to stat path " << d << ": " << e << endf; } } @@ -94,7 +94,7 @@ namespace bpkg } catch (const system_error& e) { - fail << "unable to scan directory " << d << ": " << e.what () << endf; + fail << "unable to scan directory " << d << ": " << e << endf; } } @@ -110,7 +110,7 @@ namespace bpkg } catch (const system_error& e) { - fail << "unable to create directory " << d << ": " << e.what (); + fail << "unable to create directory " << d << ": " << e; } } @@ -126,7 +126,7 @@ namespace bpkg } catch (const system_error& e) { - fail << "unable to create directory " << d << ": " << e.what (); + fail << "unable to create directory " << d << ": " << e; } } @@ -143,7 +143,7 @@ namespace bpkg } catch (const system_error& e) { - fail << "unable to remove file " << f << ": " << e.what (); + fail << "unable to remove file " << f << ": " << e; } } @@ -160,7 +160,7 @@ namespace bpkg catch (const system_error& e) { fail << "unable to remove " << (dir ? "" : "contents of ") - << "directory " << d << ": " << e.what (); + << "directory " << d << ": " << e; } } @@ -183,7 +183,7 @@ namespace bpkg } catch (const process_error& e) { - error << "unable to execute " << args[0] << ": " << e.what (); + error << "unable to execute " << args[0] << ": " << e; if (e.child ()) exit (1); -- cgit v1.1