if (NeedsLoadFromBin && _compiler != null)
return LoadTypeFromBin (_compiler, Parser);
+ Type type = null;
// This is not called if compilation failed.
// Returning null makes the caller throw an InvalidCastException
Assembly assembly = results != null ? results.CompiledAssembly : null;
- if (assembly == null)
- return null;
-
- return assembly.GetType (GetClassType (_compiler, Parser));
+ if (assembly != null) {
+ type = assembly.GetType (GetClassType (_compiler, Parser));
+ }
+ if (type == null) {
+ throw new HttpException (500, String.Format ("Type {0} could not be loaded", GetClassType (_compiler, Parser)));
+ }
+ return type;
}
// This is intended to be used by builders which may need to do special processing