Skip to content

Commit

Permalink
Add sourceInfo() to all Error.addInternalError calls
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@23159 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Nov 3, 2014
1 parent 64bbc7d commit 8cd2a88
Show file tree
Hide file tree
Showing 19 changed files with 113 additions and 115 deletions.
4 changes: 2 additions & 2 deletions Compiler/BackEnd/BackendDAECreate.mo
Expand Up @@ -1059,9 +1059,9 @@ algorithm
// case (DAE.VARIABLE(), cr, dir, flowPrefix)
// then
// BackendDAE.VARIABLE();
case (_, _, _, _)
else
equation
Error.addInternalError("./Compiler/BackEnd/BackendDAECreate.mo: function lowerKnownVarkind failed");
Error.addInternalError("function lowerKnownVarkind failed", sourceInfo());
then
fail();
end matchcontinue;
Expand Down
27 changes: 13 additions & 14 deletions Compiler/BackEnd/BackendDAETransform.mo
Expand Up @@ -111,8 +111,8 @@ algorithm
(BackendDAE.EQSYSTEM(vars,eqs,NONE(),NONE(),BackendDAE.MATCHING(ass1,ass2,comps1),stateSets,partitionKind),comps1);
else
equation
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function strongComponentsScalar failed
- sorting equations (strongComponents) failed");
Error.addInternalError("function strongComponentsScalar failed
- sorting equations (strongComponents) failed", sourceInfo());
then fail();
end matchcontinue;
end strongComponentsScalar;
Expand Down Expand Up @@ -222,7 +222,7 @@ algorithm
(compX,imark+1);
else
equation
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function analyseStrongComponentScalar failed");
Error.addInternalError("function analyseStrongComponentScalar failed", sourceInfo());
then
fail();
end match;
Expand Down Expand Up @@ -285,8 +285,8 @@ algorithm
(BackendDAE.EQSYSTEM(vars,eqs,SOME(m),SOME(mt),BackendDAE.MATCHING(ass1,ass2,comps1),stateSets,partitionKind),comps1);
else
equation
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function strongComponents failed
- sorting equations (strongComponents) failed");
Error.addInternalError("function strongComponents failed
- sorting equations (strongComponents) failed", sourceInfo());
then fail();
end matchcontinue;
end strongComponents;
Expand Down Expand Up @@ -316,7 +316,7 @@ algorithm
analyseStrongComponents(comps,syst,shared,inAss1,inAss2,acomp::iAcc);
else
equation
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function analyseStrongComponents failed");
Error.addInternalError("function analyseStrongComponents failed", sourceInfo());
then
fail();
end match;
Expand Down Expand Up @@ -350,7 +350,7 @@ algorithm
compX;
else
equation
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function analyseStrongComponent failed");
Error.addInternalError("function analyseStrongComponent failed", sourceInfo());
then
fail();
end match;
Expand Down Expand Up @@ -452,20 +452,20 @@ algorithm
var_lst = List.map(var_varindx_lst,Util.tuple21);
true = BackendVariable.hasDiscreteVar(var_lst);
false = BackendVariable.hasContinousVar(var_lst);
msg = "./Compiler/BackEnd/BackendDAETransform.mo: function analyseStrongComponentBlock failed
msg = "function analyseStrongComponentBlock failed
Sorry - Support for Discrete Equation Systems is not yet implemented\n";
crlst = List.map(var_lst,BackendVariable.varCref);
slst = List.map(crlst,ComponentReference.printComponentRefStr);
msg = msg + stringDelimitList(slst,"\n");
slst = List.map(eqn_lst,BackendDump.equationString);
msg = msg + "\n" + stringDelimitList(slst,"\n");
Error.addInternalError(msg);
Error.addInternalError(msg, sourceInfo());
then
fail();

else
equation
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function analyseStrongComponentBlock failed");
Error.addInternalError("function analyseStrongComponentBlock failed", sourceInfo());
then
fail();

Expand Down Expand Up @@ -770,7 +770,7 @@ algorithm
comps;
else
equation
Error.addMessage(Error.INTERNAL_ERROR, {"./Compiler/BackEnd/BackendDAETransform.mo: function tarjansAlgorithm failed
Error.addMessage(Error.INTERNAL_ERROR, {"./Compiler/BackEnd/function tarjansAlgorithm failed
The sorting of the equations could not be done. (strongComponents failed)
Use +d=failtrace for more information."});
then fail();
Expand Down Expand Up @@ -1262,7 +1262,7 @@ algorithm

else
equation
Error.addInternalError("./Compiler/BackEnd/BackendDAETransform.mo: function traverseBackendDAEExpsEqnWithSymbolicOperation failed");
Error.addInternalError("function traverseBackendDAEExpsEqnWithSymbolicOperation failed", sourceInfo());
then
fail();
end matchcontinue;
Expand Down Expand Up @@ -1440,8 +1440,7 @@ algorithm

else
equation
Error.addInternalError("BackendDAETransform.mo: function
traverseBackendDAEExpsWhenClauseLst failed.");
Error.addInternalError("function traverseBackendDAEExpsWhenClauseLst failed.", sourceInfo());
then
fail();
end matchcontinue;
Expand Down
4 changes: 2 additions & 2 deletions Compiler/BackEnd/BackendDump.mo
Expand Up @@ -2729,7 +2729,7 @@ algorithm
case BackendDAE.UNSPECIFIED_PARTITION() then "unspecified";
case BackendDAE.UNKNOWN_PARTITION() then "unknown";
else equation
Error.addInternalError("./Compiler/BackEnd/BackendDump.mo: function partitionKindString failed");
Error.addInternalError("function partitionKindString failed", sourceInfo());
then fail();
end match;
end partitionKindString;
Expand Down Expand Up @@ -2767,7 +2767,7 @@ algorithm
case BackendDAE.INITIAL_EQUATION() then "initial";
case BackendDAE.UNKNOWN_EQUATION_KIND() then "unknown";
else equation
Error.addInternalError("./Compiler/BackEnd/BackendDump.mo: function equationKindString failed");
Error.addInternalError("function equationKindString failed", sourceInfo());
then fail();
end match;
end equationKindString;
Expand Down
20 changes: 10 additions & 10 deletions Compiler/BackEnd/BackendEquation.mo
Expand Up @@ -1316,7 +1316,7 @@ algorithm
case (BackendDAE.EQUATION_ARRAY(numberOfElement=n), _) equation
str = "BackendEquation.equationNth1 failed; numberOfElement=" + intString(n) + "; pos=" + intString(inPos);
print(str + "\n");
Error.addInternalError(str);
Error.addInternalError(str, sourceInfo());
then fail();
end matchcontinue;
end equationNth1;
Expand Down Expand Up @@ -1349,7 +1349,7 @@ algorithm
case ({}, _, _) equation
str = "BackendEquation.equationNthSize1 failed";
print(str + "\n");
Error.addInternalError(str);
Error.addInternalError(str, sourceInfo());
then fail();

case (eqn::_, _, _) equation
Expand All @@ -1366,7 +1366,7 @@ algorithm
else equation
str = "BackendEquation.equationNthSize1 failed";
print(str + "\n");
Error.addInternalError(str);
Error.addInternalError(str, sourceInfo());
then fail();
end matchcontinue;
end equationNthSize1;
Expand Down Expand Up @@ -1450,7 +1450,7 @@ algorithm

else equation
print("BackendDAE.equationRemove failed\n");
Error.addInternalError("BackendDAE.equationRemove failed");
Error.addInternalError("BackendDAE.equationRemove failed", sourceInfo());
then fail();
end matchcontinue;
end equationRemove;
Expand Down Expand Up @@ -1794,7 +1794,7 @@ algorithm
then size;

else equation
Error.addInternalError("BackendEquation.equationSize failed!");
Error.addInternalError("BackendEquation.equationSize failed!", sourceInfo());
then fail();
end match;
end equationSize;
Expand Down Expand Up @@ -1836,7 +1836,7 @@ algorithm
case BackendDAE.COMPLEX_EQUATION(attr=BackendDAE.EQUATION_ATTRIBUTES(kind=kind)) then kind;
case BackendDAE.IF_EQUATION(attr=BackendDAE.EQUATION_ATTRIBUTES(kind=kind)) then kind;
else equation
Error.addInternalError("BackendEquation.equationKind failed!");
Error.addInternalError("BackendEquation.equationKind failed!", sourceInfo());
then fail();
end match;
end equationKind;
Expand Down Expand Up @@ -1962,7 +1962,7 @@ algorithm
case BackendDAE.IF_EQUATION(attr=attr) then attr;

else equation
Error.addInternalError("./Compiler/BackEnd/BackendEquation.mo: function getEquationAttributes failed");
Error.addInternalError("./Compiler/BackEnd/BackendEquation.mo: function getEquationAttributes failed", sourceInfo());
then fail();
end match;
end getEquationAttributes;
Expand Down Expand Up @@ -2024,7 +2024,7 @@ algorithm
then BackendDAE.IF_EQUATION(conditions, eqnstrue, eqnsfalse, source, inAttr);

else equation
Error.addInternalError("./Compiler/BackEnd/BackendEquation.mo: function setEquationAttributes failed");
Error.addInternalError("./Compiler/BackEnd/BackendEquation.mo: function setEquationAttributes failed", sourceInfo());
then fail();
end match;
end setEquationAttributes;
Expand Down Expand Up @@ -2185,7 +2185,7 @@ algorithm
*/
else equation
BackendDump.dumpBackendDAEEqnList({eqn}, "function BackendEquation.solveEquation failed w.r.t " + ExpressionDump.printExpStr(crefExp), true);
Error.addInternalError("./Compiler/BackEnd/BackendEquation.mo: function solveEquation failed");
Error.addInternalError("./Compiler/BackEnd/BackendEquation.mo: function solveEquation failed", sourceInfo());
then fail();
end matchcontinue;
end solveEquation;
Expand Down Expand Up @@ -2640,7 +2640,7 @@ algorithm
then BackendDAE.IF_EQUATION(conditions, eqnstrue, eqnsfalse, source, eqAttr);

else equation
Error.addInternalError("BackendEquation.addOperation failed");
Error.addInternalError("BackendEquation.addOperation failed", sourceInfo());
then fail();
end match;
end addOperation;
Expand Down
2 changes: 1 addition & 1 deletion Compiler/BackEnd/BackendVariable.mo
Expand Up @@ -3225,7 +3225,7 @@ algorithm
case (BackendDAE.VARIABLES(varArr = _),_)
equation
BackendDump.printVariables(inVariables);
Error.addInternalError("BackendVariable.getVarAt failed to get the variable at index: " + intString(inInteger));
Error.addInternalError("BackendVariable.getVarAt failed to get the variable at index: " + intString(inInteger), sourceInfo());
then
fail();
end matchcontinue;
Expand Down
14 changes: 7 additions & 7 deletions Compiler/BackEnd/FindZeroCrossings.mo
Expand Up @@ -931,7 +931,7 @@ algorithm
then (res2, index);

else equation
Error.addInternalError("./Compiler/BackEnd/FindZeroCrossings.mo: function replaceIteratorWithStaticValues failed");
Error.addInternalError("function replaceIteratorWithStaticValues failed", sourceInfo());
then fail();
end matchcontinue;
end replaceIteratorWithStaticValues;
Expand Down Expand Up @@ -975,7 +975,7 @@ algorithm
then ((relation, inZeroCrossings, inIndex));

else equation
Error.addInternalError("./Compiler/BackEnd/FindZeroCrossings.mo: function zcIndex failed for: " + ExpressionDump.printExpStr(inRelation));
Error.addInternalError("function zcIndex failed for: " + ExpressionDump.printExpStr(inRelation), sourceInfo());
then fail();
end matchcontinue;
end zcIndex;
Expand Down Expand Up @@ -1004,7 +1004,7 @@ algorithm
then res;

else equation
Error.addInternalError("./Compiler/BackEnd/FindZeroCrossings.mo: function mergeZeroCrossings failed");
Error.addInternalError("function mergeZeroCrossings failed", sourceInfo());
then fail();
end matchcontinue;
end mergeZeroCrossings;
Expand All @@ -1030,7 +1030,7 @@ algorithm
then BackendDAE.ZERO_CROSSING(res, eq, wc);

case (BackendDAE.ZERO_CROSSING(relation_=e1), BackendDAE.ZERO_CROSSING(relation_=e2)) equation
Error.addInternalError("./Compiler/BackEnd/FindZeroCrossings.mo: function mergeZeroCrossing failed for " + ExpressionDump.printExpStr(e1) + " and " + ExpressionDump.printExpStr(e2));
Error.addInternalError("function mergeZeroCrossing failed for " + ExpressionDump.printExpStr(e1) + " and " + ExpressionDump.printExpStr(e2), sourceInfo());
then fail();
end matchcontinue;
end mergeZeroCrossing;
Expand Down Expand Up @@ -1067,7 +1067,7 @@ algorithm
then inZCexp2;

else equation
Error.addInternalError("./Compiler/BackEnd/FindZeroCrossings.mo: function getMinZeroCrossings failed for " + ExpressionDump.printExpStr(inZCexp1) + " and " + ExpressionDump.printExpStr(inZCexp2));
Error.addInternalError("function getMinZeroCrossings failed for " + ExpressionDump.printExpStr(inZCexp1) + " and " + ExpressionDump.printExpStr(inZCexp2), sourceInfo());
then fail();
end matchcontinue;
end getMinZeroCrossings;
Expand Down Expand Up @@ -1243,7 +1243,7 @@ algorithm
then ((DAE.STMT_FAILURE(stmts2, source)::xs_1, extraArg));

case x::_ equation
Error.addInternalError("./Compiler/BackEnd/FindZeroCrossings.mo: function traverseStmtsExps failed: " + DAEDump.ppStatementStr(x));
Error.addInternalError("function traverseStmtsExps failed: " + DAEDump.ppStatementStr(x), sourceInfo());
then fail();
end match;
end traverseStmtsExps;
Expand Down Expand Up @@ -1306,7 +1306,7 @@ algorithm
then (statementLst, extraArg);

else equation
Error.addInternalError("./Compiler/BackEnd/FindZeroCrossings.mo: function traverseStmtsForExps failed");
Error.addInternalError("function traverseStmtsForExps failed", sourceInfo());
then fail();
end matchcontinue;
end traverseStmtsForExps;
Expand Down
10 changes: 5 additions & 5 deletions Compiler/BackEnd/Initialization.mo
Expand Up @@ -539,7 +539,7 @@ algorithm
then (stmts, leftCrs);

else equation
Error.addInternalError("./Compiler/BackEnd/Initialization.mo: function inlineWhenForInitializationWhenStmt failed");
Error.addInternalError("./Compiler/BackEnd/Initialization.mo: function inlineWhenForInitializationWhenStmt failed", sourceInfo());
then fail();

end matchcontinue;
Expand Down Expand Up @@ -1062,7 +1062,7 @@ algorithm
then (inVars, inEqs, iB, inDumpVars);

else equation
Error.addInternalError("./Compiler/BackEnd/Initialization.mo: function preBalanceInitialSystem1 failed");
Error.addInternalError("./Compiler/BackEnd/Initialization.mo: function preBalanceInitialSystem1 failed", sourceInfo());
then fail();
end matchcontinue;
end preBalanceInitialSystem2;
Expand Down Expand Up @@ -1406,7 +1406,7 @@ algorithm
then (eqns, var::dumpVars);

else equation
Error.addInternalError("./Compiler/BackEnd/Initialization.mo: function addStartValueEquations failed");
Error.addInternalError("./Compiler/BackEnd/Initialization.mo: function addStartValueEquations failed", sourceInfo());
then fail();
end matchcontinue;
end addStartValueEquations;
Expand Down Expand Up @@ -2264,7 +2264,7 @@ algorithm

else
equation
Error.addInternalError("./Compiler/BackEnd/Initialization.mo: function collectInitialVars failed for: " + BackendDump.varString(inVar));
Error.addInternalError("./Compiler/BackEnd/Initialization.mo: function collectInitialVars failed for: " + BackendDump.varString(inVar), sourceInfo());
then fail();

end matchcontinue;
Expand Down Expand Up @@ -2356,7 +2356,7 @@ algorithm

else
equation
Error.addInternalError("./Compiler/BackEnd/Initialization.mo: function collectInitialBindings failed for: " + BackendDump.varString(inVar));
Error.addInternalError("./Compiler/BackEnd/Initialization.mo: function collectInitialBindings failed for: " + BackendDump.varString(inVar), sourceInfo());
then fail();

end match;
Expand Down

0 comments on commit 8cd2a88

Please sign in to comment.