More informative error message in Occurrence constructor.
This commit is contained in:
parent
250ef29674
commit
2b0a2c88b7
|
@ -45,12 +45,18 @@ Occurrence::Occurrence(const Entity* entity, const Path& path)
|
|||
: _entity(const_cast<Entity*>(entity))
|
||||
, _sharedPath(path._getSharedPath())
|
||||
{
|
||||
if (!_entity) {
|
||||
throw Error("Can't create " + _TName("Occurrence") + " : null entity");
|
||||
}
|
||||
if (_sharedPath)
|
||||
if (not _entity)
|
||||
throw Error( "Occurrence::Occurrence(): NULL Entity." );
|
||||
|
||||
if (_sharedPath) {
|
||||
if (_entity->getCell() != _sharedPath->getMasterCell())
|
||||
throw Error("Can't create " + _TName("Occurrence") + " : incompatible path");
|
||||
throw Error( "Occurrence::Occurrence(): Entity incompatible with the path.\n"
|
||||
" * Entity master cell: %s\n"
|
||||
" * Path master cell: %s"
|
||||
, getString(entity->getCell()).c_str()
|
||||
, getString(_sharedPath->getMasterCell()).c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Occurrence::Occurrence(const Occurrence& occurrence)
|
||||
|
|
Loading…
Reference in New Issue