summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2017-10-14 18:05:57 +0000
committerEduard Braun <eduard.braun2@gmx.de>2017-10-14 20:41:17 +0000
commit300986fe58897667ba1c41859b5cec2f9e654efa (patch)
tree84ccdb36412199d0b468bffab6fe1a7cd3da2d6c /src/main.cpp
parentRefactoring: put SVG export into separate function (diff)
downloadinkscape-300986fe58897667ba1c41859b5cec2f9e654efa.tar.gz
inkscape-300986fe58897667ba1c41859b5cec2f9e654efa.zip
Some basic error handling for SVG export
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 5f6fc75cf..d934d1d77 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1619,16 +1619,27 @@ static int do_export_svg(SPDocument* doc)
}
}
+ int ret = 0;
if (sp_export_svg) {
- Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.plain"), doc, sp_export_svg, false,
- false, false, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY);
+ try {
+ Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.plain"), doc, sp_export_svg, false,
+ false, false, Inkscape::Extension::FILE_SAVE_METHOD_SAVE_COPY);
+ } catch (Inkscape::Extension::Output::save_failed &e) {
+ g_warning("Failed to save plain SVG to: %s", sp_export_svg);
+ ret = 1;
+ }
}
if (sp_export_inkscape_svg) {
// Export as inkscape SVG.
- Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.inkscape"), doc, sp_export_inkscape_svg, false,
- false, false, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG);
+ try {
+ Inkscape::Extension::save(Inkscape::Extension::db.get("org.inkscape.output.svg.inkscape"), doc, sp_export_inkscape_svg, false,
+ false, false, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG);
+ } catch (Inkscape::Extension::Output::save_failed &e) {
+ g_warning("Failed to save Inkscape SVG to: %s", sp_export_inkscape_svg);
+ ret = 1;
+ }
}
- return 0;
+ return ret;
}
/**