Changeset 2643


Ignore:
Timestamp:
Jun 4, 2010 6:05:46 PM (11 years ago)
Author:
prsteel
Message:

Changed the error messages to offer more suggestive hints as to what
caused the error.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.pyomo/trunk/coopr/pyomo/base/var.py

    r2614 r2643  
    224224            return self._varval[ndx]
    225225        except KeyError:
    226             raise KeyError, "Unknown index " + str(ndx) + " in variable " + self.name
     226            msg = "Unknown index '%s' in variable %s\n" % (str(ndx), self.name)
     227            msg += "    %s expects %i-dimensional indices" % (self.name, self.dim())
     228            raise KeyError, str(msg)
    227229
    228230    def is_binary(self):
Note: See TracChangeset for help on using the changeset viewer.