I'm writing .NET On-the-Fly compiler for CLR scripting. And have a dilemma: is it better to throw an exception on build fail or not?
So what is the best-practice point of view, which approach is more suitable?
try
{
compiler.Compile(); // do not throws an exception only if build succeed
}
catch(CompilerException ex)
{
string err = ex.Message;
}
or
compiler.Compile(); // throws an exception only in case of crash, etc
if(!compiler.BuildSucceed)
{
string err = compiler.Output.ToString();
}