Skip to content

Commit b644e66

Browse files
committed
bugfix: now re-arrange error handling
1 parent 83dccc9 commit b644e66

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

extension/OOoLilyPond/OOoLilyPond.xba

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -471,29 +471,26 @@ Sub Make (bSilent As Boolean) ' silent: without displaying errors; oEditor
471471

472472
'If there is no pdf output
473473
If sFormat = "pdf to svg" Then
474-
bNoFileCreated = True
475-
If Not oFileAccess.exists(sTmpPath & constOLyFileName & ".pdf") Then ' no PDF created
476-
' MsgBox("No pdf output is found", 0, "Error")
477-
MsgBox (oMessages.getPropertyValue ("sMsgNoPdfOutputFound"), iMsgBox_E, oMessages.getPropertyValue ("sCaptionError"))
478-
Else ' PDF created
479-
If oFileAccess.exists(sTmpPath & "PdfToSvg-cannot_execute") Then ' PdfToSvg execution error
480-
If StringFromFile (sLilyPondOutput, sTmpPath & constOLyFileName & "-PdfToSvg.out") Then ' can happen under Linux if pdf2svg can't find a pdf file
481-
MsgBox (oMessages.getPropertyValue ("sMsgPdfToSvgConversionFailed") & Chr(10) & Chr(10) & sLilyPondOutput, iMsgBox_E, oMessages.getPropertyValue ("sCaptionError"))
482-
Else
483-
MsgBox (oMessages.getPropertyValue ("sMsgPdfToSvgCannotExecute") & Chr(10) & Chr(10) & sPdfToSvgPrologue & ConvertFromURL(sTmpPath) & constOLyFileName & ".pdf" & sPdfToSvgEpilogue, iMsgBox_E, oMessages.getPropertyValue ("sCaptionError"))
484-
End If
485-
Else ' No PdfToSvg execution error
486-
If Not oFileAccess.exists(sTmpPath & constOLyFileName & ".svg") Then
474+
If Not oFileAccess.exists(sTmpPath & constOLyFileName & ".svg") Then
475+
bNoFileCreated = True
476+
If Not oFileAccess.exists(sTmpPath & constOLyFileName & ".pdf") Then ' no PDF created
477+
' MsgBox("No pdf output is found", 0, "Error")
478+
MsgBox (oMessages.getPropertyValue ("sMsgNoPdfOutputFound"), iMsgBox_E, oMessages.getPropertyValue ("sCaptionError"))
479+
Else ' PDF created
480+
If oFileAccess.exists(sTmpPath & "PdfToSvg-cannot_execute") Then ' PdfToSvg execution error
481+
If StringFromFile (sLilyPondOutput, sTmpPath & constOLyFileName & "-PdfToSvg.out") Then ' can happen under Linux if pdf2svg can't find a pdf file
482+
MsgBox (oMessages.getPropertyValue ("sMsgPdfToSvgConversionFailed") & Chr(10) & Chr(10) & sLilyPondOutput, iMsgBox_E, oMessages.getPropertyValue ("sCaptionError"))
483+
Else
484+
MsgBox (oMessages.getPropertyValue ("sMsgPdfToSvgCannotExecute") & Chr(10) & Chr(10) & sPdfToSvgPrologue & ConvertFromURL(sTmpPath) & constOLyFileName & ".pdf" & sPdfToSvgEpilogue, iMsgBox_E, oMessages.getPropertyValue ("sCaptionError"))
485+
End If
486+
Else ' No PdfToSvg execution error
487487
If StringFromFile (sLilyPondOutput, sTmpPath & constOLyFileName & "-PdfToSvg.out") Then
488488
MsgBox (oMessages.getPropertyValue ("sMsgPdfToSvgConversionFailed") & Chr(10) & Chr(10) & sLilyPondOutput, iMsgBox_E, oMessages.getPropertyValue ("sCaptionError"))
489489
Else
490490
MsgBox (oMessages.getPropertyValue ("sMsgPdfToSvgConversionFailed"), iMsgBox_E, oMessages.getPropertyValue ("sCaptionError"))
491491
End If
492-
Else
493-
' everything's okay, SVG file is present
494-
bNoFileCreated = True
495492
End If
496-
End If
493+
End If
497494
End If
498495
End If
499496

@@ -603,6 +600,7 @@ Sub Make (bSilent As Boolean) ' silent: without displaying errors; oEditor
603600

604601
End Sub
605602

603+
606604
Sub InsertAttribute(oGraphic As Object, sName, sValue As String)
607605
' Add a user defined attribute to the image.
608606

0 commit comments

Comments
 (0)