Bug 75556 - BASIC: LibreOffice Basic's 'Error' function does not return message which corresponds to the error code.
Summary: BASIC: LibreOffice Basic's 'Error' function does not return message which cor...
Status: RESOLVED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.1.4.2 release
Hardware: Other macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-27 03:42 UTC by martin.route66.blues+libreoffice
Modified: 2016-11-30 00:41 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description martin.route66.blues+libreoffice 2014-02-27 03:42:25 UTC
Problem description: 
Error function returns invalid value (message).
Return value must be error message (string) which corresponds to its error code.

Steps to reproduce:
1. Input the following macro on IDE.
2. Run the Bug_Error().
3. See the pop-up dialog.


```
Sub Bug_Error()
	'
	On local error goto ErrorHandler

	'
	MsgBox "Test output (must be error): " & foo
	
ErrorHandler:
	MsgBox "at line: " & Erl() & ", message (must be ""Undefined variable"" or sth; NOT be ""Foo""): " & Error( ) & " ( " & Err() & " ) "
End Sub
```


Current behavior:
"Foo"

Expected behavior:
"Undefined variable" or some appropriate message.
              
Operating System: Mac OS X
Version: 4.1.4.2 release
Comment 1 Julien Nabet 2014-03-15 06:51:22 UTC
On pc Debian x86-64 with 4.2 sources updated some days ago, I got 2 popups:
1) "Test output (must be error):" 
2) Error message: "at line: 0, message (must be "Undefined variable" or sth; NOT be "Foo"):  ( 0 )"
Comment 2 Alex Thurgood 2014-10-07 13:01:29 UTC
Version: 4.4.0.0.alpha0+
Build ID: 9bcd96a36e323a1c70eeefa81f2c8ea595f59444

~Can not reproduce on my master build, osx 10.9.5
Comment 3 Alex Thurgood 2014-10-07 13:02:10 UTC
(In reply to Alex Thurgood from comment #2)
> Version: 4.4.0.0.alpha0+
> Build ID: 9bcd96a36e323a1c70eeefa81f2c8ea595f59444
> 
> ~Can not reproduce on my master build, osx 10.9.5

Same error message as Julien
Comment 4 Alex Thurgood 2014-10-07 13:03:52 UTC
Also not reproducible on Version: 4.3.2.2
Build ID: edfb5295ba211bd31ad47d0bad0118690f76407d
Comment 5 Alex Thurgood 2014-10-07 13:04:22 UTC
Please upgrade and report back
Comment 6 QA Administrators 2015-05-06 14:14:19 UTC Comment hidden (obsolete)
Comment 7 QA Administrators 2015-06-08 14:26:57 UTC Comment hidden (obsolete)
Comment 8 Pierre Lepage 2016-11-30 00:41:46 UTC
There is no bug in the BASIC engine. In the example cited, add "Option Explicit" to generate an error in the interpretation phase. At this point, "Erl()" is initialized correctly with the number of the line and "Error()" contains the correct message and Err() contains the correct BASIC error number.

Without "Option Explicit", Erl(), Error() and Err() are respectively 0, "" and 0.