bugGNU Octave - Bugs: bug #60264, Octave error messages omit...

 
 

bug #60264: Octave error messages omit filename, thus locating error is difficult

Submitter:  PIERRE LABRECHE <pierre5018>
Submitted:  Sat 20 Mar 2021 08:55:11 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Confirmed Assigned to:  None
Originator Name:  PIERRE LABRECHE Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 06 Dec 2022 08:57:24 PM UTC, comment #2: 

adding that for old style classes, both octave and matlab behaves exactly the same.


Nicholas Jankowski <nrjank>
Group Member
Tue 06 Dec 2022 08:44:14 PM UTC, comment #1: 

note that what is reported also depends on what type of file the error is triggered in, see bug #60466. E.g., for the following test classdef class:


classdef myclass
  properties
  end

  methods
    function obj = testfun (obj, errortype)
      switch (errortype)
        case 1
          error ('my error');
        case 2
          [a,b,c] = ls ();
        case 3
          tt = sprintf ('format string %s', { } );
      end
    end
  end
end


in Octave 8.0.1:

>> x = myclass
x =

  myclass object with properties:


>> testfun(x,1)
error: my error
error: called from
    testfun at line 9 column 11
>> testfun(x,2)
error: ls: function called with too many outputs
error: called from
    ls
    testfun at line 11 column 19
>> testfun(x,3)
error: sprintf: wrong type argument 'cell'


in Matlab 2022b:

>> x = myclass
x =
  myclass with no properties.
>> testfun(x,1)
Error using myclass/testfun
my error
>> testfun(x,2)
Error using ls
Too many output arguments.
Error in myclass/testfun (line 11)
          [a,b,c] = ls ();
>> testfun(x,3)
Error using sprintf
Function is not defined for 'cell' inputs.
Error in myclass/testfun (line 13)
          tt = sprintf ('format string %s', { } );

(where each function/class name is a clickable link to either for functions the documentation or for class methods it opens the m file in the editor.)

Nicholas Jankowski <nrjank>
Group Member
Sat 20 Mar 2021 08:55:11 PM UTC, original submission:  

When an error message is displayed, the function name is listed, but not the file name.

When OO style is used the same function name can exist in many classdef structures.  A function name and its classdef name can be totally unrelated.

It would be advisable to add the filename to error messages.

For example, this error message

error: no such method or property 'foo'
error: called from
    function_fct at line 36 column 24


... is less user-friendly than

error: no such method or property 'foo'
error: called from
    function_fct in file myclass.m at line 36 column 24


PIERRE LABRECHE <pierre5018>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by nrjank (Posted a comment)
  • -email is unavailable- added by pierre5018 (Submitted the item)
  • -email is unavailable- added by pierre5018
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-12-06 nrjank StatusNone Confirmed
        Release6.2.0 dev
    2021-03-20 pierre5018 Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code