Skip to content
This repository has been archived by the owner on Apr 30, 2018. It is now read-only.

Commit

Permalink
Improved error messaging when a fragment class is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
misprintt committed Oct 30, 2012
1 parent 131de72 commit 3365ab0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/mpartial/parser/PartialClassParser.hx
Expand Up @@ -212,8 +212,7 @@ class PartialClassParser extends ClassParser
@param name qualified (or unqualified) name of a class
*/

function compilePartialFragment(name:String)
function compilePartialFragment(name:String, ?isTargetFragment:Bool=false)
{
trace("fragment", name);
var type:Type = null;
Expand All @@ -232,12 +231,14 @@ class PartialClassParser extends ClassParser
{
if(!classMap.exists(name))
{
throw "unsupported @:partials argument [" + name + "]";
if(isTargetFragment)
throw "unsupported partial target [" + name + "]\n" + e;
else
throw "unsupported @:partial argument [" + name + "]\n" + e;
}
}
}

trace(type);

if(classMap.exists(name))
{
Expand Down Expand Up @@ -292,9 +293,9 @@ class PartialClassParser extends ClassParser
hasTargetPartials = true;

var targetClass = id + "_" + target;

trace(targetClass);
Compiler.addMetadata("@:build(mpartial.PartialsMacro.fragment())", targetClass);
compilePartialFragment(targetClass);
compilePartialFragment(targetClass, true);
continue;
}
}
Expand Down

0 comments on commit 3365ab0

Please sign in to comment.