summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/ContainerScan.cxx6
-rw-r--r--test/DumpDatabase.cxx8
-rw-r--r--test/ReadApeTags.cxx6
-rw-r--r--test/WriteFile.cxx22
-rw-r--r--test/dump_playlist.cxx8
-rw-r--r--test/dump_rva2.cxx6
-rw-r--r--test/dump_text_file.cxx6
-rw-r--r--test/read_conf.cxx9
-rw-r--r--test/read_mixer.cxx6
-rw-r--r--test/read_tags.cxx10
-rw-r--r--test/run_convert.cxx6
-rw-r--r--test/run_decoder.cxx5
-rw-r--r--test/run_encoder.cxx46
-rw-r--r--test/run_filter.cxx7
-rw-r--r--test/run_gunzip.cxx16
-rw-r--r--test/run_gzip.cxx16
-rw-r--r--test/run_input.cxx5
-rw-r--r--test/run_neighbor_explorer.cxx6
-rw-r--r--test/run_normalize.cxx6
-rw-r--r--test/run_output.cxx8
-rw-r--r--test/run_storage.cxx6
-rw-r--r--test/software_volume.cxx6
-rw-r--r--test/test_vorbis_encoder.cxx6
-rw-r--r--test/visit_archive.cxx6
24 files changed, 113 insertions, 119 deletions
diff --git a/test/ContainerScan.cxx b/test/ContainerScan.cxx
index 804a8e7fa..18ac77493 100644
--- a/test/ContainerScan.cxx
+++ b/test/ContainerScan.cxx
@@ -18,7 +18,6 @@
*/
#include "config.h"
-#include "Log.hxx"
#include "DetachedSong.hxx"
#include "SongSave.hxx"
#include "decoder/DecoderList.hxx"
@@ -27,6 +26,7 @@
#include "fs/io/StdioOutputStream.hxx"
#include "fs/io/BufferedOutputStream.hxx"
#include "util/UriUtil.hxx"
+#include "util/PrintException.hxx"
#include <stdexcept>
@@ -93,7 +93,7 @@ try {
decoder_plugin_deinit_all();
return EXIT_SUCCESS;
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/DumpDatabase.cxx b/test/DumpDatabase.cxx
index aa04304b5..8f4f99d10 100644
--- a/test/DumpDatabase.cxx
+++ b/test/DumpDatabase.cxx
@@ -32,8 +32,8 @@
#include "tag/Config.hxx"
#include "fs/Path.hxx"
#include "event/Thread.hxx"
-#include "Log.hxx"
#include "util/ScopeExit.hxx"
+#include "util/PrintException.hxx"
#include <stdexcept>
#include <iostream>
@@ -152,7 +152,7 @@ try {
db->Visit(selection, DumpDirectory, DumpSong, DumpPlaylist);
return EXIT_SUCCESS;
- } catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
- }
+}
diff --git a/test/ReadApeTags.cxx b/test/ReadApeTags.cxx
index 4a1daea32..2247d58f2 100644
--- a/test/ReadApeTags.cxx
+++ b/test/ReadApeTags.cxx
@@ -21,10 +21,10 @@
#include "tag/ApeLoader.hxx"
#include "thread/Mutex.hxx"
#include "fs/Path.hxx"
-#include "Log.hxx"
#include "input/InputStream.hxx"
#include "input/LocalOpen.hxx"
#include "util/StringView.hxx"
+#include "util/PrintException.hxx"
#include <stdlib.h>
#include <stdio.h>
@@ -70,7 +70,7 @@ try {
}
return EXIT_SUCCESS;
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/WriteFile.cxx b/test/WriteFile.cxx
index e576bd4e4..1f9f3f914 100644
--- a/test/WriteFile.cxx
+++ b/test/WriteFile.cxx
@@ -19,7 +19,7 @@
#include "config.h"
#include "fs/io/FileOutputStream.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <unistd.h>
#include <errno.h>
@@ -49,7 +49,7 @@ Copy(OutputStream &dest, int src)
int
main(int argc, char **argv)
-{
+try {
if (argc != 2) {
fprintf(stderr, "Usage: WriteFile PATH\n");
return EXIT_FAILURE;
@@ -57,17 +57,15 @@ main(int argc, char **argv)
const Path path = Path::FromFS(argv[1]);
- try {
- FileOutputStream fos(path);
+ FileOutputStream fos(path);
- if (!Copy(fos, STDIN_FILENO))
- return EXIT_FAILURE;
+ if (!Copy(fos, STDIN_FILENO))
+ return EXIT_FAILURE;
- fos.Commit();
+ fos.Commit();
- return EXIT_SUCCESS;
- } catch (const std::exception &e) {
- LogError(e);
- return EXIT_FAILURE;
- }
+ return EXIT_SUCCESS;
+} catch (...) {
+ PrintException(std::current_exception());
+ return EXIT_FAILURE;
}
diff --git a/test/dump_playlist.cxx b/test/dump_playlist.cxx
index 06d1dac54..f5fdb1885 100644
--- a/test/dump_playlist.cxx
+++ b/test/dump_playlist.cxx
@@ -32,7 +32,7 @@
#include "fs/io/BufferedOutputStream.hxx"
#include "fs/io/StdioOutputStream.hxx"
#include "thread/Cond.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <unistd.h>
#include <stdlib.h>
@@ -125,7 +125,7 @@ try {
config_global_finish();
return EXIT_SUCCESS;
- } catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
- }
+}
diff --git a/test/dump_rva2.cxx b/test/dump_rva2.cxx
index 1cb821fbf..8a1daad09 100644
--- a/test/dump_rva2.cxx
+++ b/test/dump_rva2.cxx
@@ -26,7 +26,7 @@
#include "fs/Path.hxx"
#include "input/InputStream.hxx"
#include "input/LocalOpen.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <id3tag.h>
@@ -95,7 +95,7 @@ try {
DumpReplayGainInfo(replay_gain);
return EXIT_SUCCESS;
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/dump_text_file.cxx b/test/dump_text_file.cxx
index 955e82cc6..28638e8e0 100644
--- a/test/dump_text_file.cxx
+++ b/test/dump_text_file.cxx
@@ -23,7 +23,7 @@
#include "input/InputStream.hxx"
#include "input/TextInputStream.hxx"
#include "config/Global.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#ifdef ENABLE_ARCHIVE
#include "archive/ArchiveList.hxx"
@@ -96,7 +96,7 @@ try {
auto is = InputStream::OpenReady(argv[1], mutex);
return dump_input_stream(std::move(is));
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/read_conf.cxx b/test/read_conf.cxx
index b8925f17c..ecc1fc731 100644
--- a/test/read_conf.cxx
+++ b/test/read_conf.cxx
@@ -20,7 +20,8 @@
#include "config.h"
#include "config/Global.hxx"
#include "fs/Path.hxx"
-#include "Log.hxx"
+#include "fs/Path.hxx"
+#include "util/PrintException.hxx"
#include <assert.h>
#include <stdio.h>
@@ -55,7 +56,7 @@ try {
config_global_finish();
return ret;
- } catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
- }
+}
diff --git a/test/read_mixer.cxx b/test/read_mixer.cxx
index a0d7487b2..8b609e6fb 100644
--- a/test/read_mixer.cxx
+++ b/test/read_mixer.cxx
@@ -26,7 +26,7 @@
#include "Main.hxx"
#include "event/Loop.hxx"
#include "config/Block.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <assert.h>
#include <string.h>
@@ -76,7 +76,7 @@ try {
printf("%d\n", volume);
return 0;
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/read_tags.cxx b/test/read_tags.cxx
index 6d3968769..6d18eb67f 100644
--- a/test/read_tags.cxx
+++ b/test/read_tags.cxx
@@ -27,9 +27,9 @@
#include "tag/Generic.hxx"
#include "fs/Path.hxx"
#include "AudioFormat.hxx"
-#include "Log.hxx"
#include "util/ScopeExit.hxx"
#include "util/StringBuffer.hxx"
+#include "util/PrintException.hxx"
#include <stdexcept>
@@ -108,8 +108,8 @@ try {
bool success;
try {
success = plugin->ScanFile(path, h);
- } catch (const std::exception &e) {
- LogError(e);
+ } catch (...) {
+ PrintException(std::current_exception());
success = false;
}
@@ -134,7 +134,7 @@ try {
}
return 0;
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/run_convert.cxx b/test/run_convert.cxx
index 64ca98bcc..920672001 100644
--- a/test/run_convert.cxx
+++ b/test/run_convert.cxx
@@ -29,7 +29,7 @@
#include "pcm/PcmConvert.hxx"
#include "util/ConstBuffer.hxx"
#include "util/StaticFifoBuffer.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <assert.h>
#include <stddef.h>
@@ -98,7 +98,7 @@ try {
state.Close();
return EXIT_SUCCESS;
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/run_decoder.cxx b/test/run_decoder.cxx
index d4e3aef44..aa1a809c9 100644
--- a/test/run_decoder.cxx
+++ b/test/run_decoder.cxx
@@ -29,6 +29,7 @@
#include "AudioFormat.hxx"
#include "util/OptionDef.hxx"
#include "util/OptionParser.hxx"
+#include "util/PrintException.hxx"
#include "Log.hxx"
#include "LogBackend.hxx"
@@ -136,7 +137,7 @@ try {
}
return EXIT_SUCCESS;
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/run_encoder.cxx b/test/run_encoder.cxx
index 1c432558d..a1de40746 100644
--- a/test/run_encoder.cxx
+++ b/test/run_encoder.cxx
@@ -26,7 +26,7 @@
#include "AudioParser.hxx"
#include "config/Block.hxx"
#include "fs/io/StdioOutputStream.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <memory>
@@ -36,7 +36,7 @@
#include <unistd.h>
int main(int argc, char **argv)
-{
+try {
const char *encoder_name;
static char buffer[32768];
@@ -64,35 +64,33 @@ int main(int argc, char **argv)
ConfigBlock block;
block.AddBlockParam("quality", "5.0", -1);
- try {
- std::unique_ptr<PreparedEncoder> p_encoder(encoder_init(*plugin, block));
+ std::unique_ptr<PreparedEncoder> p_encoder(encoder_init(*plugin, block));
- /* open the encoder */
+ /* open the encoder */
- AudioFormat audio_format(44100, SampleFormat::S16, 2);
- if (argc > 2)
- audio_format = ParseAudioFormat(argv[2], false);
+ AudioFormat audio_format(44100, SampleFormat::S16, 2);
+ if (argc > 2)
+ audio_format = ParseAudioFormat(argv[2], false);
- std::unique_ptr<Encoder> encoder(p_encoder->Open(audio_format));
+ std::unique_ptr<Encoder> encoder(p_encoder->Open(audio_format));
- StdioOutputStream os(stdout);
+ StdioOutputStream os(stdout);
- EncoderToOutputStream(os, *encoder);
-
- /* do it */
+ EncoderToOutputStream(os, *encoder);
- ssize_t nbytes;
- while ((nbytes = read(0, buffer, sizeof(buffer))) > 0) {
- encoder->Write(buffer, nbytes);
- EncoderToOutputStream(os, *encoder);
- }
+ /* do it */
- encoder->End();
+ ssize_t nbytes;
+ while ((nbytes = read(0, buffer, sizeof(buffer))) > 0) {
+ encoder->Write(buffer, nbytes);
EncoderToOutputStream(os, *encoder);
-
- return EXIT_SUCCESS;
- } catch (const std::exception &e) {
- LogError(e);
- return EXIT_FAILURE;
}
+
+ encoder->End();
+ EncoderToOutputStream(os, *encoder);
+
+ return EXIT_SUCCESS;
+} catch (...) {
+ PrintException(std::current_exception());
+ return EXIT_FAILURE;
}
diff --git a/test/run_filter.cxx b/test/run_filter.cxx
index d81342069..8cd144c8e 100644
--- a/test/run_filter.cxx
+++ b/test/run_filter.cxx
@@ -31,8 +31,7 @@
#include "util/ConstBuffer.hxx"
#include "util/StringBuffer.hxx"
#include "util/RuntimeError.hxx"
-#include "system/FatalError.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <memory>
#include <stdexcept>
@@ -122,7 +121,7 @@ try {
config_global_finish();
return EXIT_SUCCESS;
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/run_gunzip.cxx b/test/run_gunzip.cxx
index a46eeb3f1..e58d4a207 100644
--- a/test/run_gunzip.cxx
+++ b/test/run_gunzip.cxx
@@ -21,7 +21,7 @@
#include "fs/io/GunzipReader.hxx"
#include "fs/io/FileReader.hxx"
#include "fs/io/StdioOutputStream.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <stdio.h>
#include <stdlib.h>
@@ -57,7 +57,7 @@ CopyGunzip(FILE *_dest, Path src_path)
int
main(int argc, gcc_unused char **argv)
-{
+try {
if (argc != 2) {
fprintf(stderr, "Usage: run_gunzip PATH\n");
return EXIT_FAILURE;
@@ -65,11 +65,9 @@ main(int argc, gcc_unused char **argv)
Path path = Path::FromFS(argv[1]);
- try {
- CopyGunzip(stdout, path);
- return EXIT_SUCCESS;
- } catch (const std::exception &e) {
- LogError(e);
- return EXIT_FAILURE;
- }
+ CopyGunzip(stdout, path);
+ return EXIT_SUCCESS;
+} catch (...) {
+ PrintException(std::current_exception());
+ return EXIT_FAILURE;
}
diff --git a/test/run_gzip.cxx b/test/run_gzip.cxx
index c018c3167..f305ba844 100644
--- a/test/run_gzip.cxx
+++ b/test/run_gzip.cxx
@@ -21,7 +21,7 @@
#include "fs/io/GzipOutputStream.hxx"
#include "fs/io/StdioOutputStream.hxx"
#include "system/Error.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <stdio.h>
#include <stdlib.h>
@@ -61,17 +61,15 @@ CopyGzip(FILE *_dest, int src)
int
main(int argc, gcc_unused char **argv)
-{
+try {
if (argc != 1) {
fprintf(stderr, "Usage: run_gzip\n");
return EXIT_FAILURE;
}
- try {
- CopyGzip(stdout, STDIN_FILENO);
- return EXIT_SUCCESS;
- } catch (const std::exception &e) {
- LogError(e);
- return EXIT_FAILURE;
- }
+ CopyGzip(stdout, STDIN_FILENO);
+ return EXIT_SUCCESS;
+} catch (...) {
+ PrintException(std::current_exception());
+ return EXIT_FAILURE;
}
diff --git a/test/run_input.cxx b/test/run_input.cxx
index dc3fa1063..991567f8f 100644
--- a/test/run_input.cxx
+++ b/test/run_input.cxx
@@ -37,6 +37,7 @@
#include "util/ConstBuffer.hxx"
#include "util/OptionDef.hxx"
#include "util/OptionParser.hxx"
+#include "util/PrintException.hxx"
#ifdef ENABLE_ARCHIVE
#include "archive/ArchiveList.hxx"
@@ -241,7 +242,7 @@ try {
Mutex mutex;
auto is = InputStream::OpenReady(c.uri, mutex);
return dump_input_stream(is.get());
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/run_neighbor_explorer.cxx b/test/run_neighbor_explorer.cxx
index 3184cdc91..f836bc148 100644
--- a/test/run_neighbor_explorer.cxx
+++ b/test/run_neighbor_explorer.cxx
@@ -25,7 +25,7 @@
#include "fs/Path.hxx"
#include "event/Loop.hxx"
#include "ShutdownHandler.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <stdio.h>
#include <stdlib.h>
@@ -93,7 +93,7 @@ try {
loop.Run();
neighbor.Close();
return EXIT_SUCCESS;
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/run_normalize.cxx b/test/run_normalize.cxx
index 277fe44a8..b5ef830be 100644
--- a/test/run_normalize.cxx
+++ b/test/run_normalize.cxx
@@ -27,7 +27,7 @@
#include "AudioCompress/compress.h"
#include "AudioParser.hxx"
#include "AudioFormat.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <stdexcept>
@@ -63,7 +63,7 @@ try {
Compressor_delete(compressor);
return EXIT_SUCCESS;
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/run_output.cxx b/test/run_output.cxx
index 8437eefa8..bf22d0657 100644
--- a/test/run_output.cxx
+++ b/test/run_output.cxx
@@ -32,7 +32,7 @@
#include "util/StringBuffer.hxx"
#include "util/RuntimeError.hxx"
#include "util/ScopeExit.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <memory>
@@ -146,7 +146,7 @@ try {
config_global_finish();
return EXIT_SUCCESS;
- } catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
- }
+}
diff --git a/test/run_storage.cxx b/test/run_storage.cxx
index 1ab8d625d..02e5aa7c1 100644
--- a/test/run_storage.cxx
+++ b/test/run_storage.cxx
@@ -18,13 +18,13 @@
*/
#include "config.h"
-#include "Log.hxx"
#include "event/Thread.hxx"
#include "storage/Registry.hxx"
#include "storage/StorageInterface.hxx"
#include "storage/FileInfo.hxx"
#include "net/Init.hxx"
#include "util/ChronoUtil.hxx"
+#include "util/PrintException.hxx"
#include <memory>
#include <stdexcept>
@@ -124,7 +124,7 @@ try {
}
return EXIT_SUCCESS;
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/software_volume.cxx b/test/software_volume.cxx
index fc233a7c7..69f71f77a 100644
--- a/test/software_volume.cxx
+++ b/test/software_volume.cxx
@@ -28,7 +28,7 @@
#include "AudioParser.hxx"
#include "AudioFormat.hxx"
#include "util/ConstBuffer.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <stdio.h>
#include <stddef.h>
@@ -59,7 +59,7 @@ try {
}
pv.Close();
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/test_vorbis_encoder.cxx b/test/test_vorbis_encoder.cxx
index 76b1face3..3cadf77dc 100644
--- a/test/test_vorbis_encoder.cxx
+++ b/test/test_vorbis_encoder.cxx
@@ -27,7 +27,7 @@
#include "fs/io/StdioOutputStream.hxx"
#include "tag/Tag.hxx"
#include "tag/Builder.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <memory>
@@ -95,7 +95,7 @@ try {
EncoderToOutputStream(os, *encoder);
return EXIT_SUCCESS;
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}
diff --git a/test/visit_archive.cxx b/test/visit_archive.cxx
index c8a87e27a..d6bf43ff5 100644
--- a/test/visit_archive.cxx
+++ b/test/visit_archive.cxx
@@ -27,7 +27,7 @@
#include "archive/ArchiveFile.hxx"
#include "archive/ArchiveVisitor.hxx"
#include "fs/Path.hxx"
-#include "Log.hxx"
+#include "util/PrintException.hxx"
#include <stdexcept>
@@ -95,7 +95,7 @@ try {
file->Visit(visitor);
return result;
-} catch (const std::exception &e) {
- LogError(e);
+} catch (...) {
+ PrintException(std::current_exception());
return EXIT_FAILURE;
}