From 290766598cfd4870081fe71ea1deed9e39efd3a2 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Tue, 10 Jul 2018 00:03:43 +1200 Subject: [PATCH] survexport: Catch and report wxString exceptions This means we now report a useful error for trying to convert a .3d file without coordinate system information to GPS. Reported by Mark Shinwell. --- src/survexport.cc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/survexport.cc b/src/survexport.cc index 1a51daea..a58cdc8c 100644 --- a/src/survexport.cc +++ b/src/survexport.cc @@ -420,13 +420,19 @@ main(int argc, char **argv) if (err) fatalerror(err, fnm_in); if (filter) filter->SetSeparator(model.GetSeparator()); - if (!Export(fnm_out, model.GetSurveyTitle(), - model.GetDateString(), - model, filter, - pan, tilt, show_mask, format, - grid, text_height, marker_size, - scale)) { - fatalerror(/*Couldn’t write file “%s”*/402, fnm_out); + try { + if (!Export(fnm_out, model.GetSurveyTitle(), + model.GetDateString(), + model, filter, + pan, tilt, show_mask, format, + grid, text_height, marker_size, + scale)) { + fatalerror(/*Couldn’t write file “%s”*/402, fnm_out); + } + } catch (const wxString & m) { + wxFprintf(stderr, wxT("%s: %s: %s\n"), + msg_appname(), wmsg(/*error*/93), m); } + return 0; } -- 2.11.4.GIT