Shovel.Vm.Vm.RaiseShovelError C# (CSharp) Метод

RaiseShovelError() статический приватный Метод

static private RaiseShovelError ( string message ) : void
message string
Результат void
        void RaiseShovelError(string message)
        {
            var sb = new StringBuilder ();
            sb.AppendLine (message);
            sb.AppendLine ();
            sb.AppendLine ("Current stack trace:");
            this.WriteStackTrace (sb);
            sb.AppendLine ();
            sb.AppendLine ("Current environment:");
            sb.AppendLine ();
            this.WriteCurrentEnvironment (sb);
            var fileName = this.FindFileName (this.programCounter);
            int? line = null, column = null;
            if (fileName != null && this.sources != null) {
                var source = SourceFile.FindSource (this.sources, fileName);
                if (source != null) {
                    int? startPos, endPos;
                    this.FindStartEndPos (out startPos, out endPos);
                    if (startPos != null) {
                        var pos = Position.CalculatePosition (source, startPos.Value);
                        if (pos != null) {
                            line = pos.Line;
                            column = pos.Column;
                        }
                    }
                }
            }
            throw new ShovelException (){
                    ShovelMessage = sb.ToString(),
                    FileName = fileName,
                    Line = line,
                    Column = column
                };
        }

Usage Example

Пример #1
0
 static void HandlePrim0(Vm vm)
 {
     var instruction = vm.CurrentInstruction ();
     if (vm.GetCurrentCache () == null) {
         var primName = (string)instruction.Arguments;
         if (!Vm.Prim0Hash.ContainsKey (primName)) {
             vm.RaiseShovelError (String.Format (
                 "Cannot take address of primitive '{0}' (implemented as instruction).",
                 primName)
             );
         }
         vm.SetCurrentCache (Value.Make (Vm.Prim0Hash [primName]));
     }
     vm.stack.Push ((Value)vm.GetCurrentCache ());
     vm.IncrementTicks (1);
     vm.programCounter++;
 }
All Usage Examples Of Shovel.Vm.Vm::RaiseShovelError
Vm