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

                        var scriptError = error as IActiveScriptError;
                        if (scriptError != null)
                        {
                            EXCEPINFO excepInfo;
                            scriptError.GetExceptionInfo(out excepInfo);
                            if (RawCOMHelpers.HResult.GetFacility(excepInfo.scode) == RawCOMHelpers.HResult.FACILITY_CONTROL)
                            {
                                syntaxError = engine.SyntaxErrorMap.ContainsKey(RawCOMHelpers.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());
                    }
                }

                return(message);
            }
            private string GetDetails(object error, string message)
            {
                if (engine.engineFlags.HasFlag(WindowsScriptEngineFlags.EnableDebugging))
                {
                    try
                    {
                        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());
                    }
                }

                return(message);
            }