summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-04-27 20:50:13 +0100
committerCarl Hetherington <cth@carlh.net>2014-04-27 20:50:13 +0100
commita4afc8e3dd6ce7c5f02d0eb69f03bf9f043afed0 (patch)
treee9557ef5be1824e68b47c21b0d8980995053ba92 /src
parent2be230e3923fa75d41cd3218f9f54da199a1273c (diff)
Open an error dialogue on uncaught exceptions in the main loop. Check that the ImageContent constructor found some valid files when scanning a folder.
Diffstat (limited to 'src')
-rw-r--r--src/lib/image_content.cc6
-rw-r--r--src/lib/job.cc4
-rw-r--r--src/tools/dcpomatic.cc11
-rw-r--r--src/wx/film_editor.cc15
4 files changed, 28 insertions, 8 deletions
diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc
index 13f7c52e3..3b87fcf00 100644
--- a/src/lib/image_content.cc
+++ b/src/lib/image_content.cc
@@ -44,7 +44,11 @@ ImageContent::ImageContent (shared_ptr<const Film> f, boost::filesystem::path p)
_paths.push_back (i->path ());
}
}
-
+
+ if (_paths.empty()) {
+ throw FileError (_("No valid image files were found in the folder."), p);
+ }
+
sort (_paths.begin(), _paths.end());
}
}
diff --git a/src/lib/job.cc b/src/lib/job.cc
index 52499b433..96aedac65 100644
--- a/src/lib/job.cc
+++ b/src/lib/job.cc
@@ -108,7 +108,7 @@ Job::run_wrapper ()
set_error (
e.what (),
- _("It is not known what caused this error. The best idea is to report the problem to the DCP-o-matic mailing list (carl@dcpomatic.com)")
+ _("It is not known what caused this error. Please report the problem to the DCP-o-matic author (carl@dcpomatic.com).")
);
set_progress (1);
@@ -118,7 +118,7 @@ Job::run_wrapper ()
set_error (
_("Unknown error"),
- _("It is not known what caused this error. The best idea is to report the problem to the DCP-o-matic mailing list (carl@dcpomatic.com)")
+ _("It is not known what caused this error. Please report the problem to the DCP-o-matic author (carl@dcpomatic.com).")
);
set_progress (1);
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc
index 2f64371ae..1abd25198 100644
--- a/src/tools/dcpomatic.cc
+++ b/src/tools/dcpomatic.cc
@@ -733,6 +733,17 @@ class App : public wxApp
return true;
}
+ bool OnExceptionInMainLoop ()
+ {
+ error_dialog (0, _("An unknown exception occurred. Please report this problem to the DCP-o-matic author (carl@dcpomatic.com)."));
+ return false;
+ }
+
+ void OnUnhandledException ()
+ {
+ error_dialog (0, _("An unknown exception occurred. Please report this problem to the DCP-o-matic author (carl@dcpomatic.com)."));
+ }
+
void idle ()
{
ui_signaller->ui_idle ();
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index 31b9b8368..1131675bc 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -803,11 +803,16 @@ FilmEditor::content_add_folder_clicked ()
return;
}
- _film->examine_and_add_content (
- shared_ptr<ImageContent> (
- new ImageContent (_film, boost::filesystem::path (wx_to_std (d->GetPath ())))
- )
- );
+ shared_ptr<ImageContent> ic;
+
+ try {
+ ic.reset (new ImageContent (_film, boost::filesystem::path (wx_to_std (d->GetPath ()))));
+ } catch (FileError& e) {
+ error_dialog (this, std_to_wx (e.what ()));
+ return;
+ }
+
+ _film->examine_and_add_content (ic);
}
void