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
};
}