From eac5143f3af748c42928b27e060532504bf545ea Mon Sep 17 00:00:00 2001 From: Florent Lamiraux <florent@laas.fr> Date: Tue, 7 Jun 2011 10:45:47 +0200 Subject: [PATCH] Homogeneize error messages. --- src/dynamic_graph/entity.py | 2 +- src/entity-py.cc | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/dynamic_graph/entity.py b/src/dynamic_graph/entity.py index 37a0997..7b140da 100644 --- a/src/dynamic_graph/entity.py +++ b/src/dynamic_graph/entity.py @@ -155,7 +155,7 @@ class Entity (object) : try: object.__getattr__(self, name) except AttributeError: - raise AttributeError('Entity named "%s" has no attribute %s\n'% + raise AttributeError("'%s' entity has no attribute %s\n"% (self.name, name)+ ' entity attributes are usually either\n'+ ' - commands,\n'+ diff --git a/src/entity-py.cc b/src/entity-py.cc index c6d8ab0..0744a3e 100644 --- a/src/entity-py.cc +++ b/src/entity-py.cc @@ -207,9 +207,10 @@ namespace dynamicgraph { entity->getNewStyleCommandMap(); if (commandMap.count(std::string(commandName)) != 1) { - std::string msg = "command " + std::string(commandName) + - " is not referenced in Entity " + entity->getName(); - PyErr_SetString(dgpyError, msg.c_str()); + std::ostringstream oss; + oss << "'" << entity->getName() << "' entity has no command '" + << commandName << "'."; + PyErr_SetString(PyExc_AttributeError, oss.str().c_str()); return NULL; } Command* command = commandMap[std::string(commandName)]; -- GitLab