summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2021-05-04 14:28:54 +0200
committerJean-Pierre Ledure <jp@ledure.be>2021-05-04 16:14:10 +0200
commitf38c39534ffc9f33bfa4a588624c35b662b55b62 (patch)
tree2f66bd525b1e444b96c870fff0b464dd074c2f4d /wizards
parent30312222e5f7de5ebbabbf8ad33e373a53385971 (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')
-rw-r--r--wizards/source/scriptforge/SF_Exception.xba4
-rw-r--r--wizards/source/scriptforge/SF_Root.xba7
-rw-r--r--wizards/source/scriptforge/SF_TextStream.xba10
-rw-r--r--wizards/source/scriptforge/po/ScriptForge.pot13
-rw-r--r--wizards/source/scriptforge/po/en.po13
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 = &quot;SENDMAILERROR&quot;
&apos; SF_TextStream
Const FILENOTOPENERROR = &quot;FILENOTOPENERROR&quot;
Const FILEOPENMODEERROR = &quot;FILEOPENMODEERROR&quot;
+Const ENDOFFILEERROR = &quot;ENDOFFILEERROR&quot;
&apos; SF_UI
Const DOCUMENTERROR = &quot;DOCUMENTERROR&quot;
@@ -842,6 +843,9 @@ Try:
Case FILEOPENMODEERROR &apos; SF_TextStream._IsFileOpen(FileName)
sMessage = sLocation _
&amp; &quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;FILEOPENMODE&quot;, pvArgs(0), pvArgs(1))
+ Case ENDOFFILEERROR &apos; SF_TextStream.ReadLine/ReadAll/SkipLine(FileName)
+ sMessage = sLocation _
+ &amp; &quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;ENDOFFILE&quot;, pvArgs(0))
Case DOCUMENTERROR &apos; SF_UI.GetDocument(ArgName, WindowName)
sMessage = sLocation _
&amp; &quot;\n&quot; &amp; &quot;\n&quot; &amp; &quot;\n&quot; &amp; .GetText(&quot;VALIDATEERROR&quot;, 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:
&amp; &quot;%1: A file name\n&quot; _
&amp; &quot;%2: READ, WRITE or APPEND&quot; _
)
+ &apos; SF_TextStream.ReadLine, ReadAll, SkipLine
+ .AddText( Context := &quot;ENDOFFILE&quot; _
+ , MsgId := &quot;The requested file read operation could not be completed because an unexpected end-of-file was encountered.\n\n&quot; _
+ &amp; &quot;File name = &apos;%1&apos;&quot; _
+ , Comment := &quot;SF_TextStream.ReadLine/ReadAll/SkipLine error message\n&quot; _
+ &amp; &quot;%1: A file name&quot; _
+ )
&apos; SF_UI.Document
.AddText( Context := &quot;DOCUMENT&quot; _
, MsgId := &quot;The requested document could not be found.\n\n&quot; _
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 = &quot;FILENOTOPENERROR&quot; &apos; The file is already closed
Const FILEOPENMODEERROR = &quot;FILEOPENMODEERROR&quot; &apos; The file is open in incompatible mode
+Const ENDOFFILEERROR = &quot;ENDOFFILEERROR&quot; &apos; When file was read, an end-of-file was encountered
REM ============================================================= PRIVATE MEMBERS
@@ -341,8 +342,7 @@ Finally:
Catch:
GoTo Finally
CatchEOF:
- &apos;TODO: SF_Exception.RaiseFatal(FILEWRITEMODEERROR, cstThisSub)
- MsgBox &quot;END OF FILE ERROR !!&quot;
+ SF_Exception.RaiseFatal(ENDOFFILEERROR, FileName)
GoTo Finally
End Function &apos; ScriptForge.SF_TextStream.ReadAll
@@ -406,8 +406,7 @@ Finally:
Catch:
GoTo Finally
CatchEOF:
- &apos;TODO: SF_Exception.RaiseFatal(FILEWRITEMODEERROR, cstThisSub)
- MsgBox &quot;END OF FILE ERROR !!&quot;
+ SF_Exception.RaiseFatal(ENDOFFILEERROR, FileName)
GoTo Finally
End Function &apos; ScriptForge.SF_TextStream.ReadLine
@@ -486,8 +485,7 @@ Finally:
Catch:
GoTo Finally
CatchEOF:
- &apos;TODO: SF_Exception.RaiseFatal(FILEWRITEMODEERROR, cstThisSub)
- MsfBox &quot;END OF FILE ERROR !!&quot;
+ SF_Exception.RaiseFatal(ENDOFFILEERROR, FileName)
GoTo Finally
End Sub &apos; 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