bugGNU Octave - Bugs: bug #49155, No error identifier when loading a...

 
 

bug #49155: No error identifier when loading a nonexistant package

Submitter:  Francesco Potortì <pot>
Submitted:  Thu 22 Sep 2016 11:01:23 AM UTC
   
 
Category:  Octave Function Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Feature Request
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * 4.0.3 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 22 Sep 2016 10:17:27 PM UTC, comment #4: 

Is a specific error id for missing package really that useful? If you have a program that needs a specific package, then it doesn't matter for the writer of the program if the package fails to load because is not installed or if there is some other reason that makes it fail to load. And when it matters, it's easy to check first if the package is installed.

I'd imagine the following snippet to be more useful in a real case:


try
  pkg load foobar;
catch
  error ("failed to load package foobar: %s", lasterr ());
end_try_catch


Which in my cases throws back "error: failed to load package foobar: package foobar is not installed" (in practice, I never check this, the uncatched error message should be enough).

Also, note that just because a package is loaded, doesn't mean a specific function will be available. Some packages will disable some functions.

Carnë Draug <carandraug>
Group Member
Thu 22 Sep 2016 06:22:46 PM UTC, comment #3: 

Absolutely, sounds like a good dea.

Rik <rik5>
Group administrator
Thu 22 Sep 2016 06:15:44 PM UTC, comment #2: 

There are very few errors in the entire scripts directory that do have error identifiers, this error is just one of thousands.

It's a development goal for all errors in Octave to have identifiers, right? Maybe we should recategorize this as a project or task with wider scope than just this one error message.

Mike Miller <mtmiller>
Group Member
Thu 22 Sep 2016 03:23:02 PM UTC, comment #1: 

Confirmed.  Sample code to demonstrate the issue:


octave:6> pkg load abc
error: package abc is not installed
error: called from
    load_packages at line 41 column 7
    pkg at line 409 column 7
octave:6> lasterror
ans =

  scalar structure containing the fields:

    message = package abc is not installed
    identifier =
    stack =

      2x1 struct array containing the fields:

        file
        name
        line
        column
        scope
        context


This was tested with the 4.2.0-rc2 version of Octave.

Rik <rik5>
Group administrator
Thu 22 Sep 2016 11:01:23 AM UTC, original submission:  

If I do

> load pkg nonexistent


the thrown erro is anonymous as reported by

> lasterror


This error should have an identifier

Francesco Potortì <pot>

 

(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 mtmiller (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by pot (Submitted the item)
  •  

    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
    2016-09-22 rik5 SummaryNo erorr identifier when load a nonexisting package No error identifier when loading a nonexistant package
    2016-09-22 rik5 Severity3 - Normal 2 - Minor
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code