[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #63556] error() function shows traceback messa
From: |
José Luis García Pallero |
Subject: |
[Octave-bug-tracker] [bug #63556] error() function shows traceback messages when error message end with newline in special cases |
Date: |
Wed, 21 Dec 2022 12:47:52 -0500 (EST) |
URL:
<https://savannah.gnu.org/bugs/?63556>
Summary: error() function shows traceback messages when error
message end with newline in special cases
Project: GNU Octave
Submitter: jgpallero
Submitted: mié 21 dic 2022 17:47:50
Category: Octave Function
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Inaccurate Result
Status: None
Assigned to: None
Originator Name: jgpallero
Originator Email:
Open/Closed: Open
Release: 7.3.0
Discussion Lock: Any
Operating System: Any
Fixed Release: None
Planned Release: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: mié 21 dic 2022 17:47:50 By: José Luis García Pallero
<jgpallero>
According to Octave documentation, in the error() function
If the error message ends in a newline character, Octave will print
the message but will not display any traceback messages as it
returns control to the top level
See this first exmple
function [b] = test1(a)
b = subfunction(a);
function [b] = subfunction(a)
if nargin<2
error('Incorrect number (%d) of input parameters \n',nargin);
end
and now this
function [b] = test2(a)
b = subfunction(a);
function [b] = subfunction(a)
if nargin<2
error('Incorrect number of input parameters\n');
end
I obtain this results:
>> test1(8)
error: Incorrect number of input parameters (1)
>> test2(8)
error: Incorrect number of input parameters\n
error: called from
test2>subfunction at line 8 column 5
test2 at line 3 column 3
Only the first example works as expected, i.e., not printing the error
traceback as the error message end with the '\n' character. The only
difference in the error() calls is that in the first case information is
passed through %d. Is this a bug in error()?
Also, if I insert some '\n' in the middle of the error message, it is only
interpreted if information were passed to the message, i.e., something as
error('Incorrect number (%d) of\ninput parameters \n',nargin);
will produce the message
error: Incorrect number (1) of
input parameters
but if I write
error('Incorrect number of\ninput parameters \n');
the result is
error: Incorrect number of\ninput parameters\n
error: called from
test2>subfunction at line 8 column 5
test2 at line 3 column 3
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?63556>
_______________________________________________
Mensaje enviado vía Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #63556] error() function shows traceback messages when error message end with newline in special cases,
José Luis García Pallero <=