aboutsummaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
Diffstat (limited to 'samples')
-rw-r--r--samples/amber.cc26
1 files changed, 14 insertions, 12 deletions
diff --git a/samples/amber.cc b/samples/amber.cc
index 9bfa950..7f27d00 100644
--- a/samples/amber.cc
+++ b/samples/amber.cc
@@ -339,7 +339,8 @@ int main(int argc, const char** argv) {
if (!result.IsSuccess()) {
std::cerr << file << ": " << result.Error() << std::endl;
failures.push_back(file);
- continue;
+ // Note, we continue after failure to allow dumping the buffers which may
+ // give clues as to the failure.
}
if (!options.image_filename.empty()) {
@@ -360,19 +361,20 @@ int main(int argc, const char** argv) {
break;
}
}
- if (!result.IsSuccess()) {
+ if (result.IsSuccess()) {
+ std::ofstream image_file;
+ image_file.open(options.image_filename,
+ std::ios::out | std::ios::binary);
+ if (!image_file.is_open()) {
+ std::cerr << "Cannot open file for image dump: ";
+ std::cerr << options.image_filename << std::endl;
+ continue;
+ }
+ image_file << image;
+ image_file.close();
+ } else {
std::cerr << result.Error() << std::endl;
- continue;
- }
- std::ofstream image_file;
- image_file.open(options.image_filename, std::ios::out | std::ios::binary);
- if (!image_file.is_open()) {
- std::cerr << "Cannot open file for image dump: ";
- std::cerr << options.image_filename << std::endl;
- continue;
}
- image_file << image;
- image_file.close();
}
if (!options.buffer_filename.empty()) {