Unity-Technologies/unityscript2csharp

“try/catch" is not support yet?

mantis3d opened this issue · 2 comments

try {
	VetP = GetComponent.<Pjson>().getModelByName(TheJson,Cscript.Right_node[ii].name);
	Cscript.Right_node[ii].localPosition = VetP;
	print("Right_node["+ii+"].localPosition"+Cscript.Right_node[ii].name+VetP);
} catch (e) {
	print("++++Error+Right+"+Cscript.Right_node[ii].name);
}

got converted as

/* Node type not supported yet 
try:
	VetP = self.GetComponent[of Pjson]().getModelByName(TheJson, Cscript.Left_node[ii].name)
	Cscript.Left_node[ii].localPosition = VetP
	UnityEngine.MonoBehaviour.print((((('Left_node[' + ii) + '].localPosition') + Cscript.Left_node[ii].name) + VetP))
except e as System.Exception:
	UnityEngine.MonoBehaviour.print(('++++Error+left+' + Cscript.Left_node[ii].name))

@I:\unity\FaceHairMakerLocal2017b\Assets\scripts\data\io\SaveModelScript.js(249,9)*/
            {
                Vector3 VetP = this.GetComponent<Pjson>().getModelByName(TheJson, Cscript.Left_node[ii].name);
                //CoverText.text = "z2a"+ii+"x"+VetP;
                Cscript.Left_node[ii].localPosition = VetP;
                MonoBehaviour.print(((("Left_node[" + ii) + "].localPosition") + Cscript.Left_node[ii].name) + VetP);
            }
            /* Node type not supported yet 
except e as System.Exception:
	UnityEngine.MonoBehaviour.print(('++++Error+left+' + Cscript.Left_node[ii].name))

@I:\unity\FaceHairMakerLocal2017b\Assets\scripts\data\io\SaveModelScript.js(255,11)*/System.Exception e
         {
                //CoverText.text = "z2a"+ii+"\ne:"+e.message;
                MonoBehaviour.print("++++Error+left+" + Cscript.Left_node[ii].name);
         }

There are some constructs that are not supported (for example properties & events declarations) that we don't plan to support.

That being said, exception handling looks to be important enough (looks like we overlooked it); I'll see if I can work on it this week.

Thanks for pointing out.

@mantis3d, I have just pushed a new release with support for try/catch/finally. Let me know if it works for you