octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48439] validateattributes throws errors witho


From: Carlo de Falco
Subject: [Octave-bug-tracker] [bug #48439] validateattributes throws errors without IDs
Date: Thu, 7 Jul 2016 16:34:34 +0000 (UTC)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:47.0) Gecko/20100101 Firefox/47.0

URL:
  <http://savannah.gnu.org/bugs/?48439>

                 Summary: validateattributes throws errors without IDs
                 Project: GNU Octave
            Submitted by: cdf
            Submitted on: Thu 07 Jul 2016 06:34:32 PM CEST
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: Patch Submitted
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

Hi,

When using validateattributes to check consistency of input
arguments, Matlab throws an error with a different identifier
depending on the type of error.

Octave does not currently set any identifier.

In Matlab :


>> validateattributes (1, {'numeric'}, {'<=', -1})
Expected input to be an array with all of the values <= -1.

>> lasterror

ans = 

       message: 'Expected input to be an array with all of the values <= -1.'
    identifier: 'MATLAB:notLessEqual'
         stack: [0x1 struct]

>> validateattributes (rand (5), {'uint8'}, {})
Expected input to be one of these types:

uint8

Instead its type was double.
 
>> lasterror

ans = 

       message: 'Expected input to be one of these types:…'
    identifier: 'MATLAB:invalidType'
         stack: [0x1 struct]


In Octave validateattributes does not currently set an ID 
when throwing an error:



>> validateattributes (1, {'numeric'}, {'<=', -1})
error: input must be less than or equal to -1.000000
error: called from
    validateattributes at line 324 column 11
>> lasterror
ans =

  scalar structure containing the fields:

    message = input must be less than or equal to -1.000000
    identifier = 

>> validateattributes (rand (5), {'uint8'}, {})
error: input must be of class:

  uint8

but was of class double
error: called from
    validateattributes at line 227 column 5
>> lasterror
ans =

  scalar structure containing the fields:

    message = input must be of class:

  uint8

but was of class double
    identifier = 



The attached patch addresses this by adding an error ID.
The ID is always set to "Octave:invalid-input-arg" as it
seems the only appropriate one in the current list of error_ids.

Shall I push this chset?











    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thu 07 Jul 2016 06:34:32 PM CEST  Name: open_SyvI97zm.txt  Size: 5kB  
By: cdf

<http://savannah.gnu.org/bugs/download.php?file_id=37760>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48439>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]