public StringCompilerCli( string name, string targetName, string extension, AphidStringEmitter emitter, bool isText) { _name = name; _targetName = targetName; _extension = extension; _emitter = emitter; _isText = isText; _args = Environment.GetCommandLineArgs().Skip(1).ToArray(); AphidErrorReporter.Init(); }
private static bool TryActionCore( AphidInterpreter interpreter, Func <string> getCode, Action action, bool allowErrorReporting) { var backup = false; try { backup = interpreter.SetIsInTryCatchFinally(true); #if APHID_FRAME_ADD_DATA || APHID_FRAME_CATCH_POP try { #endif action(); #if APHID_FRAME_ADD_DATA || APHID_FRAME_CATCH_POP } #endif #if APHID_FRAME_ADD_DATA || APHID_FRAME_CATCH_POP #if APHID_FRAME_ADD_DATA catch (Exception e) #else catch #endif { if (e.Source != AphidName.DebugInterpreter) { e.Source = AphidName.DebugInterpreter; #if APHID_FRAME_CATCH_POP interpreter.PopQueuedFrames(1); #endif #if APHID_FRAME_ADD_DATA e.Data.Add(AphidName.Interpreter, interpreter); e.Data.Add(AphidName.FramesKey, interpreter.GetRawStackTrace()); #endif } throw; } #endif interpreter.SetIsInTryCatchFinally(backup); return(true); } catch (ThreadAbortException exception) { if (!IsAborting) { Thread.ResetAbort(); LastException = exception; DumpException(exception, interpreter); } } catch (AphidParserException exception) { LastException = exception; DumpException(exception, getCode()); } catch (AphidLoadScriptException exception) { LastException = exception; DumpException(exception, interpreter); } catch (AphidRuntimeException exception) { LastException = exception; DumpException(exception, interpreter); } catch (TargetInvocationException exception) when(exception.InnerException is AphidParserException parserException) { LastException = parserException; DumpException(parserException, getCode()); } catch (TargetInvocationException exception) when(exception.InnerException is AphidLoadScriptException loadScriptException) { LastException = loadScriptException; DumpException(loadScriptException, interpreter); } catch (TargetInvocationException exception) when(exception.InnerException is AphidRuntimeException runtimeException) { LastException = runtimeException; DumpException(runtimeException, interpreter); } catch (Exception exception) { LastException = exception; DumpException(exception, interpreter); } if (allowErrorReporting) { AphidErrorReporter.Report(LastException, interpreter, passThrough: false); } interpreter.SetIsInTryCatchFinally(backup); return(false); }