{
if (!orgCell->connectTo(connInfo->connectionName, tgtCell))
{
- std::string message = std::string("Failed to make connection. Receptor name for the target cell may be duplicated. (").append(connInfo->connectionName).append(" cell:").append(connInfo->originCellName).append(" - > ").append(connInfo->targetCellName);
+ std::string message = std::string("Failed to make connection. Receptor name for the target cell may be duplicated. (").append(connInfo->connectionName).append(") cell:").append(connInfo->originCellName).append(" - > ").append(connInfo->targetCellName);
dnNotifyError("Initialization failed", message);
}
}
else
{
- std::string message = std::string("Failed to make connection (").append(connInfo->connectionName).append(" cell:").append(connInfo->originCellName).append(" - > ").append(connInfo->targetCellName);
+ std::string message = std::string("Failed to make connection (").append(connInfo->connectionName).append(") cell:").append(connInfo->originCellName).append(" - > ").append(connInfo->targetCellName);
dnNotifyError("Initialization failed", message);
}
mPendingConnections.pop();
#include "dnqscellcodeinstance.h"
#include "DNGlobal.h"
+#include <QStringList>
+
DNQSCellCode::DNQSCellCode(std::string name, std::string cellapi, DNQSContainer *container, std::string code):
TKCellCode(name,cellapi), mCellContainer(container)
{
if (scriptEngine->hasUncaughtException())
{
QScriptValue error = scriptEngine->uncaughtException();
+ int lineNumber = scriptEngine->uncaughtExceptionLineNumber();
+ QStringList list = stmt.split("\n", QString::KeepEmptyParts);
+ QString errorStatement = "";
+ if (lineNumber <= list.length())
+ {
+ int i = lineNumber < 2 ? 0 : lineNumber - 2;
+ int j = i + 2 <= list.length() ? i + 2 : list.length() - 1;
+ while (i <= j)
+ {
+ errorStatement += list.at(i);
+ errorStatement += "\n";
+ i++;
+ }
+ }
QString errorString = error.toString();
scriptEngine->clearExceptions();
std::string message = "Failed to construct Cell code : ";
- message.append(getName()).append("\n");
- message.append("Error Message:").append(errorString.toStdString());
+ message += getName();
+ message += "\n";
+ if (errorStatement.length()>0)
+ {
+ message += ("Statement:\n...\n");
+ message += errorStatement.toStdString();
+ message += "...\n";
+ }
+ message += "Error Message:";
+ message += errorString.toStdString();
dnNotifyError("Initialization failed", message);
return;
}
if (scriptEngine->hasUncaughtException())
{
QScriptValue error = scriptEngine->uncaughtException();
+ int lineNumber = scriptEngine->uncaughtExceptionLineNumber();
+ QStringList list = customScriptStr.split("\n", QString::KeepEmptyParts);
+ QString errorStatement = "";
+ if (lineNumber <= list.length())
+ {
+ int i = lineNumber < 2 ? 0 : lineNumber - 2;
+ int j = i + 2 <= list.length() ? i + 2 : list.length() - 1;
+ while (i <= j)
+ {
+ errorStatement += list.at(i);
+ errorStatement += "\n";
+ i++;
+ }
+ }
QString errorString = error.toString();
scriptEngine->clearExceptions();
- std::string message = "";
- message.append("Failed to construct Cell code '");
- message.append(owner->getName()).append("'\n");
- message.append("cellcode:");
- message.append(getName()).append("\n");
- message.append("Error Message:").append(errorString.toStdString());
+ std::string message = "Failed to construct Cell '";
+ message += owner->getName();
+ message += "'\n";
+ message += "cellcode:";
+ message += getName();
+ message += "\n";
+ if (errorStatement.length()>0)
+ {
+ message += ("Statement:\n...\n");
+ message += errorStatement.toStdString();
+ message += "...\n";
+ }
+ message += "Error Message:";
+ message += errorString.toStdString();
dnNotifyError("Initialization failed", message);
}