diff options
author | Jean-Pierre Ledure <jp@ledure.be> | 2021-05-04 14:28:54 +0200 |
---|---|---|
committer | Jean-Pierre Ledure <jp@ledure.be> | 2021-05-04 16:14:10 +0200 |
commit | f38c39534ffc9f33bfa4a588624c35b662b55b62 (patch) | |
tree | 2f66bd525b1e444b96c870fff0b464dd074c2f4d /wizards/source/scriptforge | |
parent | 30312222e5f7de5ebbabbf8ad33e373a53385971 (diff) |
ScriptForge - (SF_TextStream)FIX raise error when end-of-file
Error was announced with a message box.
Error message was not translatable.
Managed with standard exception handling.
Change-Id: I10d67985ec4bdebce5bda9123caddb4134646b48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115095
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Diffstat (limited to 'wizards/source/scriptforge')
-rw-r--r-- | wizards/source/scriptforge/SF_Exception.xba | 4 | ||||
-rw-r--r-- | wizards/source/scriptforge/SF_Root.xba | 7 | ||||
-rw-r--r-- | wizards/source/scriptforge/SF_TextStream.xba | 10 | ||||
-rw-r--r-- | wizards/source/scriptforge/po/ScriptForge.pot | 13 | ||||
-rw-r--r-- | wizards/source/scriptforge/po/en.po | 13 |
5 files changed, 39 insertions, 8 deletions
diff --git a/wizards/source/scriptforge/SF_Exception.xba b/wizards/source/scriptforge/SF_Exception.xba index ddfe56a069c8..6bdf9908a411 100644 --- a/wizards/source/scriptforge/SF_Exception.xba +++ b/wizards/source/scriptforge/SF_Exception.xba @@ -85,6 +85,7 @@ Const SENDMAILERROR = "SENDMAILERROR" ' SF_TextStream Const FILENOTOPENERROR = "FILENOTOPENERROR" Const FILEOPENMODEERROR = "FILEOPENMODEERROR" +Const ENDOFFILEERROR = "ENDOFFILEERROR" ' SF_UI Const DOCUMENTERROR = "DOCUMENTERROR" @@ -842,6 +843,9 @@ Try: Case FILEOPENMODEERROR ' SF_TextStream._IsFileOpen(FileName) sMessage = sLocation _ & "\n" & "\n" & .GetText("FILEOPENMODE", pvArgs(0), pvArgs(1)) + Case ENDOFFILEERROR ' SF_TextStream.ReadLine/ReadAll/SkipLine(FileName) + sMessage = sLocation _ + & "\n" & "\n" & .GetText("ENDOFFILE", pvArgs(0)) Case DOCUMENTERROR ' SF_UI.GetDocument(ArgName, WindowName) sMessage = sLocation _ & "\n" & "\n" & "\n" & .GetText("VALIDATEERROR", pvArgs(0)) _ diff --git a/wizards/source/scriptforge/SF_Root.xba b/wizards/source/scriptforge/SF_Root.xba index 39cf315bd3d2..0a5aaa6055ab 100644 --- a/wizards/source/scriptforge/SF_Root.xba +++ b/wizards/source/scriptforge/SF_Root.xba @@ -647,6 +647,13 @@ Try: & "%1: A file name\n" _ & "%2: READ, WRITE or APPEND" _ ) + ' SF_TextStream.ReadLine, ReadAll, SkipLine + .AddText( Context := "ENDOFFILE" _ + , MsgId := "The requested file read operation could not be completed because an unexpected end-of-file was encountered.\n\n" _ + & "File name = '%1'" _ + , Comment := "SF_TextStream.ReadLine/ReadAll/SkipLine error message\n" _ + & "%1: A file name" _ + ) ' SF_UI.Document .AddText( Context := "DOCUMENT" _ , MsgId := "The requested document could not be found.\n\n" _ diff --git a/wizards/source/scriptforge/SF_TextStream.xba b/wizards/source/scriptforge/SF_TextStream.xba index 27ff3d9bb4c9..827c5e303344 100644 --- a/wizards/source/scriptforge/SF_TextStream.xba +++ b/wizards/source/scriptforge/SF_TextStream.xba @@ -41,6 +41,7 @@ REM ================================================================== EXCEPTION Const FILENOTOPENERROR = "FILENOTOPENERROR" ' The file is already closed Const FILEOPENMODEERROR = "FILEOPENMODEERROR" ' The file is open in incompatible mode +Const ENDOFFILEERROR = "ENDOFFILEERROR" ' When file was read, an end-of-file was encountered REM ============================================================= PRIVATE MEMBERS @@ -341,8 +342,7 @@ Finally: Catch: GoTo Finally CatchEOF: - 'TODO: SF_Exception.RaiseFatal(FILEWRITEMODEERROR, cstThisSub) - MsgBox "END OF FILE ERROR !!" + SF_Exception.RaiseFatal(ENDOFFILEERROR, FileName) GoTo Finally End Function ' ScriptForge.SF_TextStream.ReadAll @@ -406,8 +406,7 @@ Finally: Catch: GoTo Finally CatchEOF: - 'TODO: SF_Exception.RaiseFatal(FILEWRITEMODEERROR, cstThisSub) - MsgBox "END OF FILE ERROR !!" + SF_Exception.RaiseFatal(ENDOFFILEERROR, FileName) GoTo Finally End Function ' ScriptForge.SF_TextStream.ReadLine @@ -486,8 +485,7 @@ Finally: Catch: GoTo Finally CatchEOF: - 'TODO: SF_Exception.RaiseFatal(FILEWRITEMODEERROR, cstThisSub) - MsfBox "END OF FILE ERROR !!" + SF_Exception.RaiseFatal(ENDOFFILEERROR, FileName) GoTo Finally End Sub ' ScriptForge.SF_TextStream.SkipLine diff --git a/wizards/source/scriptforge/po/ScriptForge.pot b/wizards/source/scriptforge/po/ScriptForge.pot index 012eebf29466..709175d73147 100644 --- a/wizards/source/scriptforge/po/ScriptForge.pot +++ b/wizards/source/scriptforge/po/ScriptForge.pot @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice&bug_status=UNCONFIRMED&component=UI\n" -"POT-Creation-Date: 2021-05-02 17:38:42\n" +"POT-Creation-Date: 2021-05-04 14:09:55\n" "PO-Revision-Date: YYYY-MM-DD HH:MM:SS\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n" @@ -514,6 +514,17 @@ msgid "" "Open mode = %2" msgstr "" +#. SF_TextStream.ReadLine/ReadAll/SkipLine error message +#. %1: A file name +#, kde-format +msgctxt "ENDOFFILE" +msgid "" +"The requested file read operation could not be completed because an " +"unexpected end-of-file was encountered.\n" +"\n" +"File name = '%1'" +msgstr "" + #. SF_UI.GetDocument error message #. %1: An identifier #. %2: A string diff --git a/wizards/source/scriptforge/po/en.po b/wizards/source/scriptforge/po/en.po index 012eebf29466..709175d73147 100644 --- a/wizards/source/scriptforge/po/en.po +++ b/wizards/source/scriptforge/po/en.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: https://bugs.libreoffice.org/enter_bug.cgi?product=LibreOffice&bug_status=UNCONFIRMED&component=UI\n" -"POT-Creation-Date: 2021-05-02 17:38:42\n" +"POT-Creation-Date: 2021-05-04 14:09:55\n" "PO-Revision-Date: YYYY-MM-DD HH:MM:SS\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n" @@ -514,6 +514,17 @@ msgid "" "Open mode = %2" msgstr "" +#. SF_TextStream.ReadLine/ReadAll/SkipLine error message +#. %1: A file name +#, kde-format +msgctxt "ENDOFFILE" +msgid "" +"The requested file read operation could not be completed because an " +"unexpected end-of-file was encountered.\n" +"\n" +"File name = '%1'" +msgstr "" + #. SF_UI.GetDocument error message #. %1: An identifier #. %2: A string |