diff --git a/pcbnew/exporters/export_svg.cpp b/pcbnew/exporters/export_svg.cpp
index 7cc868c13e..b0097161ed 100644
--- a/pcbnew/exporters/export_svg.cpp
+++ b/pcbnew/exporters/export_svg.cpp
@@ -117,13 +117,17 @@ bool EXPORT_SVG::Plot( BOARD* aBoard, const PCB_PLOT_SVG_OPTIONS& aSvgPlotOption
         plotter->SetColorMode( !aSvgPlotOptions.m_blackAndWhite );
         PlotBoardLayers( aBoard, plotter, aSvgPlotOptions.m_printMaskLayer, plot_opts );
         plotter->EndPlot();
+
+        delete plotter;
+
+        // reset to the values saved earlier
+        aBoard->GetDesignSettings().SetAuxOrigin( savedAuxOrigin );
+        aBoard->SetPageSettings( savedPageInfo );
+
+        return true;
+    }
+    else
+    {
+        return false;
     }
-
-    delete plotter;
-
-    // reset to the values saved earlier
-    aBoard->GetDesignSettings().SetAuxOrigin( savedAuxOrigin );
-    aBoard->SetPageSettings( savedPageInfo );
-
-    return true;
 }
diff --git a/pcbnew/pcbnew_jobs_handler.cpp b/pcbnew/pcbnew_jobs_handler.cpp
index 99c22b38c9..64154f15a2 100644
--- a/pcbnew/pcbnew_jobs_handler.cpp
+++ b/pcbnew/pcbnew_jobs_handler.cpp
@@ -651,11 +651,15 @@ int PCBNEW_JOBS_HANDLER::JobExportSvg( JOB* aJob )
     brd->SynchronizeProperties();
 
     if( EXPORT_SVG::Plot( brd, svgPlotOptions ) )
+    {
         m_reporter->Report( _( "Successfully created svg file" ) + wxS( "\n" ), RPT_SEVERITY_INFO );
+        return CLI::EXIT_CODES::OK;
+    }
     else
+    {
         m_reporter->Report( _( "Error creating svg file" ) + wxS( "\n" ), RPT_SEVERITY_ERROR );
-
-    return CLI::EXIT_CODES::OK;
+        return CLI::EXIT_CODES::ERR_INVALID_OUTPUT_CONFLICT;
+    }
 }