summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-02-25 12:57:16 +0100
committerAraq <rumpf_a@web.de>2012-02-25 12:57:16 +0100
commit4a9e07a47c40c672734a09934eca3a7e54897216 (patch)
tree78c07417c9c62d65a1f24261550390c244334f34
parentd72b00cf15402b050f4a1ca7e5e73a5968550d0c (diff)
downloadNim-4a9e07a47c40c672734a09934eca3a7e54897216.tar.gz
ERecoverableError exception contains the error message
-rwxr-xr-xcompiler/docgen.nim1
-rwxr-xr-xcompiler/msgs.nim25
-rwxr-xr-xcompiler/rst.nim4
-rwxr-xr-xcompiler/semexprs.nim4
-rwxr-xr-xweb/news.txt10
5 files changed, 20 insertions, 24 deletions
diff --git a/compiler/docgen.nim b/compiler/docgen.nim
index 14a8b35c2..d70f92ac4 100755
--- a/compiler/docgen.nim
+++ b/compiler/docgen.nim
@@ -884,6 +884,7 @@ proc CommandRst2TeX =
 # ---------- forum ---------------------------------------------------------
 
 proc setupConfig*() =
+  msgs.gErrorMax = 1000_000
   setConfigVar("split.item.toc", "20")
   setConfigVar("doc.section", """
 <div class="section" id="$sectionID">
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index 7b4d38efa..90f85a402 100755
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -447,8 +447,8 @@ proc newLineInfo*(filename: string, line, col: int): TLineInfo {.inline.} =
 fileInfos.add(newFileInfo("", "command line"))
 var gCmdLineInfo* = newLineInfo(int32(0), 1, 1)
 
-proc raiseRecoverableError*() {.noinline, noreturn.} =
-  raise newException(ERecoverableError, "")
+proc raiseRecoverableError*(msg: string) {.noinline, noreturn.} =
+  raise newException(ERecoverableError, msg)
 
 var
   gNotes*: TNoteKinds = {low(TNoteKind)..high(TNoteKind)}
@@ -560,7 +560,7 @@ proc inCheckpoint*(current: TLineInfo): TCheckPointResult =
 type
   TErrorHandling = enum doNothing, doAbort, doRaise
 
-proc handleError(msg: TMsgKind, eh: TErrorHandling) = 
+proc handleError(msg: TMsgKind, eh: TErrorHandling, s: string) = 
   if msg == errInternal: 
     assert(false)             # we want a stack trace here
   if msg >= fatalMin and msg <= fatalMax: 
@@ -574,7 +574,7 @@ proc handleError(msg: TMsgKind, eh: TErrorHandling) =
       if gVerbosity >= 3: assert(false)
       quit(1)                 # one error stops the compiler
     elif eh == doRaise:
-      raiseRecoverableError()
+      raiseRecoverableError(s)
   
 proc `==`(a, b: TLineInfo): bool = 
   result = a.line == b.line and a.fileIndex == b.fileIndex
@@ -606,8 +606,9 @@ proc rawMessage*(msg: TMsgKind, args: openarray[string]) =
     if not (msg in gNotes): return 
     frmt = rawHintFormat
     inc(gHintCounter)
-  MsgWriteln(`%`(frmt, `%`(msgKindToString(msg), args)))
-  handleError(msg, doAbort)
+  let s = `%`(frmt, `%`(msgKindToString(msg), args))
+  MsgWriteln(s)
+  handleError(msg, doAbort, s)
 
 proc rawMessage*(msg: TMsgKind, arg: string) = 
   rawMessage(msg, [arg])
@@ -636,10 +637,11 @@ proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string,
     ignoreMsg = optHints notin gOptions or msg notin gNotes
     frmt = posHintFormat
     inc(gHintCounter)
+  let s = frmt % [toFilename(info), coordToStr(info.line),
+                  coordToStr(info.col), getMessageStr(msg, arg)]
   if not ignoreMsg:
-    MsgWriteln(frmt % [toFilename(info), coordToStr(info.line),
-                       coordToStr(info.col), getMessageStr(msg, arg)])
-  handleError(msg, eh)
+    MsgWriteln(s)
+  handleError(msg, eh, s)
   
 proc Fatal*(info: TLineInfo, msg: TMsgKind, arg = "") = 
   liMessage(info, msg, arg, doAbort)
@@ -653,11 +655,6 @@ proc LocalError*(info: TLineInfo, msg: TMsgKind, arg = "") =
 proc Message*(info: TLineInfo, msg: TMsgKind, arg = "") =
   liMessage(info, msg, arg, doNothing)
 
-proc GenericMessage*(info: TLineInfo, msg: TMsgKind, arg = "") =
-  ## does the right thing for old code that is written with "abort on first
-  ## error" in mind.
-  liMessage(info, msg, arg, doAbort)
-
 proc InternalError*(info: TLineInfo, errMsg: string) = 
   writeContext(info)
   liMessage(info, errInternal, errMsg, doAbort)
diff --git a/compiler/rst.nim b/compiler/rst.nim
index 2ca2960c7..168ac4496 100755
--- a/compiler/rst.nim
+++ b/compiler/rst.nim
@@ -289,10 +289,10 @@ proc tokInfo(p: TRstParser, tok: TToken): TLineInfo =
   result = newLineInfo(p.filename, p.line + tok.line, p.col + tok.col)
 
 proc rstMessage(p: TRstParser, msgKind: TMsgKind, arg: string) = 
-  GenericMessage(tokInfo(p, p.tok[p.idx]), msgKind, arg)
+  GlobalError(tokInfo(p, p.tok[p.idx]), msgKind, arg)
 
 proc rstMessage(p: TRstParser, msgKind: TMsgKind) = 
-  GenericMessage(tokInfo(p, p.tok[p.idx]), msgKind, p.tok[p.idx].symbol)
+  GlobalError(tokInfo(p, p.tok[p.idx]), msgKind, p.tok[p.idx].symbol)
 
 proc currInd(p: TRstParser): int = 
   result = p.indentStack[high(p.indentStack)]
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 4ae803c36..c97dc3963 100755
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -26,7 +26,7 @@ proc semExprWithType(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
   result = semExpr(c, n, flags)
   if result.kind == nkEmpty: 
     # do not produce another redundant error message:
-    raiseRecoverableError()
+    raiseRecoverableError("")
   if result.typ != nil: 
     if result.typ.kind == tyVar: result = newDeref(result)
   else:
@@ -37,7 +37,7 @@ proc semExprNoDeref(c: PContext, n: PNode, flags: TExprFlags = {}): PNode =
   result = semExpr(c, n, flags)
   if result.kind == nkEmpty: 
     # do not produce another redundant error message:
-    raiseRecoverableError()
+    raiseRecoverableError("")
   if result.typ == nil:
     GlobalError(n.info, errExprXHasNoType, 
                 renderTree(result, {renderNoComments}))
diff --git a/web/news.txt b/web/news.txt
index fdf3a63ea..6c0e85f6b 100755
--- a/web/news.txt
+++ b/web/news.txt
@@ -19,15 +19,13 @@ Library Additions
 
 - Added ``system.shallow`` that can be used to speed up string and sequence
   assignments.
-
 - Added ``system.static`` that can force compile-time evaluation of certain
-  expressions
-
+  expressions.
 - Added ``system.eval`` that can execute an anonymous block of code at
-  compile time as if was a macro
-
+  compile time as if was a macro.
 - Added ``macros.emit`` that can emit an arbitrary computed string as nimrod
-  code during compilation
+  code during compilation.
+
 
 2012-02-09 Version 0.8.14 released
 ==================================