octave-maintainers
[Top][All Lists]
Advanced

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

improved traceback error messages


From: John W. Eaton
Subject: improved traceback error messages
Date: Tue, 05 Aug 2008 22:13:40 -0400

I've checked in a change to improve the traceback error messages that
Octave prints when an error happens inside a function.  Currently,
given the following functions all in separate .m files

  function f ()
    x = "f";
    if (strcmp (x, "f"))
      g ("g");
    endif
  endfunction

  function g (a)
    x = a;
    if (1)
      switch (x)
        case "g"
          h (x);
      endswitch
    endif
  endfunction

  function h (x)
    if (x)
      for i = 1
        y = 2;
        z = 4;
        a = rand (y);
        b = rand (z);
        a + b;
      endfor
    endif
  endfunction

Octave will spew the following set of messages:

  error: operator +: nonconformant arguments (op1 is 2x2, op2 is 4x4)
  error: evaluating binary operator `+' near line 8, column 9
  error: evaluating for command near line 3, column 5
  error: evaluating if command near line 2, column 3
  error: called from `h' in file `/scratch/jwe/build/octave/h.m'
  error: evaluating switch command near line 4, column 5
  error: evaluating if command near line 3, column 3
  error: called from `g' in file `/scratch/jwe/build/octave/g.m'
  error: evaluating if command near line 3, column 3
  error: called from `f' in file `/scratch/jwe/build/octave/f.m'

With the changes I checked in, it will print:

  error: operator +: nonconformant arguments (op1 is 2x2, op2 is 4x4)
  error: called from:
  error:   /scratch/jwe/build/octave/h.m at line 8, column 9
  error:   /scratch/jwe/build/octave/g.m at line 6, column 9
  error:   /scratch/jwe/build/octave/f.m at line 4, column 5

This takes care of the next to last change for 3.2 that I consider
most important (at least to me personally).  The last is fsolve
compatibility, and I'll try to take a look at that next.

jwe


reply via email to

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