From 2b0a2c88b79ca346724e9ee7cc7b49fea2dcd5b9 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Wed, 13 Jan 2021 19:05:20 +0100 Subject: [PATCH] More informative error message in Occurrence constructor. --- hurricane/src/hurricane/Occurrence.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/hurricane/src/hurricane/Occurrence.cpp b/hurricane/src/hurricane/Occurrence.cpp index ccb9b975..075667c5 100644 --- a/hurricane/src/hurricane/Occurrence.cpp +++ b/hurricane/src/hurricane/Occurrence.cpp @@ -45,12 +45,18 @@ Occurrence::Occurrence(const Entity* entity, const Path& path) : _entity(const_cast(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)