Skip to content

Commit

Permalink
- report an user understandable error message when trying to instanti…
Browse files Browse the repository at this point in the history
…ate or check an model that does not exists.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@11522 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Mar 25, 2012
1 parent 544986d commit 64677d4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Compiler/Script/CevalScript.mo
Expand Up @@ -1332,8 +1332,9 @@ algorithm
equation
cr_1 = Absyn.pathToCref(className);
false = Interactive.existClass(cr_1, p);
str = "Unknown model in instantiateModel: " +& Absyn.pathString(className) +& "\n";
then
(cache,Values.STRING("Unknown model.\n"),st);
(cache,Values.STRING(str),st);

case (cache,env,"instantiateModel",{Values.CODE(Absyn.C_TYPENAME(path))},st,msg)
equation
Expand Down Expand Up @@ -3639,6 +3640,14 @@ algorithm
then
(cache,Values.STRING(retStr),st);

case (cache,env,className,st as Interactive.SYMBOLTABLE(ast=p), _)
equation
classNameStr = Absyn.pathString(className);
false = Interactive.existClass(Absyn.pathToCref(className), p);
errorMsg = "Unknown model in checkModel: " +& classNameStr +& "\n";
then
(cache,Values.STRING(errorMsg),st);

// errors
case (cache,env,className,st,_)
equation
Expand Down

0 comments on commit 64677d4

Please sign in to comment.