Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Issue159 assign node error message #163

Merged
merged 2 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions src/palladio/SOPAssign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ RuleFileInfoUPtr getRuleFileInfo(const MainAttributes& ma, const ResolveMapSPtr&
}

bool evaluateDefaultRuleAttributes(const GU_Detail* detail, ShapeData& shapeData,
const ShapeConverterUPtr& shapeConverter, const PRTContextUPtr& prtCtx) {
const ShapeConverterUPtr& shapeConverter, const PRTContextUPtr& prtCtx,
std::string& errors) {
WA("all");

assert(shapeData.isValid());
Expand All @@ -89,8 +90,10 @@ bool evaluateDefaultRuleAttributes(const GU_Detail* detail, ShapeData& shapeData
// try to get a resolve map
ResolveMapSPtr resolveMap = prtCtx->getResolveMap(ma.mRPK);
if (!resolveMap) {
LOG_WRN << "Could not create resolve map from rpk " << ma.mRPK
<< ", aborting default rule attribute evaluation";
errors.append("Could not read Rule Package '")
.append(ma.mRPK.string())
.append("', aborting default rule attribute evaluation");
LOG_ERR << errors;
return false;
}

Expand Down Expand Up @@ -124,8 +127,13 @@ bool evaluateDefaultRuleAttributes(const GU_Detail* detail, ShapeData& shapeData
const prt::Status stat = prt::generate(is.data(), is.size(), nullptr, encs, encsCount, encsOpts, &aec,
prtCtx->mPRTCache.get(), nullptr, nullptr, nullptr);
if (stat != prt::STATUS_OK) {
LOG_ERR << "assign: prt::generate() failed with status: '" << prt::getStatusDescription(stat) << "' (" << stat
<< ")";
errors.append("Failed to evaluate default attributes with status: '")
.append(prt::getStatusDescription(stat))
.append("' (")
.append(std::to_string(stat))
.append(")");
LOG_ERR << errors;
return false;
}

assert(shapeData.isValid());
Expand Down Expand Up @@ -158,9 +166,14 @@ OP_ERROR SOPAssign::cookMySop(OP_Context& context) {

ShapeData shapeData;
mShapeConverter->get(gdp, primCls, shapeData, mPRTCtx);
const bool canContinue = evaluateDefaultRuleAttributes(gdp, shapeData, mShapeConverter, mPRTCtx);
std::string evalAttrErrorMessage;
const bool canContinue =
evaluateDefaultRuleAttributes(gdp, shapeData, mShapeConverter, mPRTCtx, evalAttrErrorMessage);
if (!canContinue) {
LOG_ERR << getName() << ": aborting, could not successfully evaluate default rule attributes";
const std::string errMsg =
"Could not successfully evaluate default rule attributes:\n" + evalAttrErrorMessage;
LOG_ERR << getName() << ": " << errMsg;
addError(SOP_MESSAGE, errMsg.c_str());
return UT_ERROR_ABORT;
}
mShapeConverter->put(gdp, primCls, shapeData);
Expand Down
2 changes: 1 addition & 1 deletion src/palladio/SOPGenerate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ OP_ERROR SOPGenerate::cookMySop(OP_Context& context) {
const size_t isSuccesses = std::count(initialShapeStatus.begin(), initialShapeStatus.end(), prt::STATUS_OK);
if (isSuccesses == 0) {
LOG_ERR << getName() << ": All initial shapes failed to generate, cooking aborted.";
addError(UT_ERROR_ABORT, "All initial shapes failed to generate.");
addError(SOP_MESSAGE, "All initial shapes failed to generate.");
return UT_ERROR_ABORT;
}
// TODO: evaluate batchStatus as well...
Expand Down