Ejemplo n.º 1
0
            private string GetDetails(object error, string message)
            {
                if (engine.processDebugManager != null)
                {
                    try
                    {
                        var syntaxError = false;

                        if (error is IActiveScriptError scriptError)
                        {
                            scriptError.GetExceptionInfo(out var excepInfo);
                            if (HResult.GetFacility(excepInfo.scode) == HResult.FACILITY_CONTROL)
                            {
                                syntaxError = engine.SyntaxErrorMap.ContainsKey(HResult.GetCode(excepInfo.scode));
                            }
                        }

                        if (syntaxError)
                        {
                            var details = message;

                            var errorLocation = GetErrorLocation(error);
                            if (!string.IsNullOrWhiteSpace(errorLocation))
                            {
                                details += "\n" + errorLocation;
                            }

                            var stackTrace = engine.GetStackTraceInternal();
                            if (!string.IsNullOrWhiteSpace(stackTrace))
                            {
                                details += "\n" + stackTrace;
                            }

                            return(details);
                        }
                        else
                        {
                            var stackTrace = engine.GetStackTraceInternal();
                            if (!string.IsNullOrWhiteSpace(stackTrace))
                            {
                                return(message + "\n" + stackTrace);
                            }

                            var errorLocation = GetErrorLocation(error);
                            if (!string.IsNullOrWhiteSpace(errorLocation))
                            {
                                return(message + "\n" + errorLocation);
                            }
                        }
                    }
                    catch (Exception exception)
                    {
                        Debug.Assert(false, "Exception caught during error processing", exception.ToString());
                    }
                }
                else
                {
                    var errorLocation = GetErrorLocation(error);
                    if (!string.IsNullOrWhiteSpace(errorLocation))
                    {
                        return(message + "\n" + errorLocation);
                    }
                }

                return(message);
            }