Mono.JavaScript.Node.Debugger.NodeDebuggerSession.OnInsertBreakEvent C# (CSharp) Method

OnInsertBreakEvent() protected method

protected OnInsertBreakEvent ( Mono.Debugging.Client.BreakEvent be ) : Mono.Debugging.Client.BreakEventInfo
be Mono.Debugging.Client.BreakEvent
return Mono.Debugging.Client.BreakEventInfo
        protected override BreakEventInfo OnInsertBreakEvent(BreakEvent be)
        {
            Breakpoint bp = be as Breakpoint;
            if (bp == null)
                throw new NotSupportedException ();

            BreakEventInfo bi = new BreakEventInfo ();

            lock (nodeLock) {
                bool dres = InternalStop ();
                try {
                    string handle;
                    try {
                        if (bp is FunctionBreakpoint) {
                            var bf = (FunctionBreakpoint) bp;
                            handle = "function " + bf.FunctionName;
                            var ret = debugger.SetBreakpoint ("function", bf.FunctionName, be.Enabled, -1, -1, bp.ConditionExpression, bp.HitCount);
                        } else {
                            handle = string.Format ("{0} ({1},1)", bp.FileName, bp.Line);
                            var ret = debugger.SetBreakpoint ("script", bp.FileName, be.Enabled, bp.Line, 1, bp.ConditionExpression, bp.HitCount);
                        }
                    } catch (Exception ex) {
                        bi.SetStatus (BreakEventStatus.Invalid, ex.Message);
                        return bi;
                    }
                    bi.Handle = handle;
                    bi.SetStatus (BreakEventStatus.Bound, null);
                    return bi;
                } finally {
                    InternalResume (dres);
                }
            }
        }