mirror of
https://github.com/kanaka/mal.git
synced 2024-09-20 01:57:09 +03:00
fsharp: added some top level exception catching so that the repl wouldn't quit to CLI on errors.
This commit is contained in:
parent
3c823be2f8
commit
df8c925a24
@ -31,9 +31,15 @@ module REPL
|
||||
try
|
||||
Some(eval env ast)
|
||||
with
|
||||
| Error.EvalError(msg)
|
||||
| Error.ReaderError(msg) ->
|
||||
printfn "%s" msg
|
||||
| Error.EvalError(str)
|
||||
| Error.ReaderError(str) ->
|
||||
printfn "%s" str
|
||||
None
|
||||
| Error.MalError(node) ->
|
||||
printfn "%s" (Printer.pr_str [node])
|
||||
None
|
||||
| ex ->
|
||||
printfn "%s" (ex.Message)
|
||||
None
|
||||
|
||||
let PRINT v =
|
||||
|
@ -67,9 +67,15 @@ module REPL
|
||||
try
|
||||
Some(eval env ast)
|
||||
with
|
||||
| Error.EvalError(msg)
|
||||
| Error.ReaderError(msg) ->
|
||||
printfn "%s" msg
|
||||
| Error.EvalError(str)
|
||||
| Error.ReaderError(str) ->
|
||||
printfn "%s" str
|
||||
None
|
||||
| Error.MalError(node) ->
|
||||
printfn "%s" (Printer.pr_str [node])
|
||||
None
|
||||
| ex ->
|
||||
printfn "%s" (ex.Message)
|
||||
None
|
||||
|
||||
let PRINT v =
|
||||
|
@ -103,9 +103,15 @@ module REPL
|
||||
try
|
||||
Some(eval env ast)
|
||||
with
|
||||
| Error.EvalError(msg)
|
||||
| Error.ReaderError(msg) ->
|
||||
printfn "%s" msg
|
||||
| Error.EvalError(str)
|
||||
| Error.ReaderError(str) ->
|
||||
printfn "%s" str
|
||||
None
|
||||
| Error.MalError(node) ->
|
||||
printfn "%s" (Printer.pr_str [node])
|
||||
None
|
||||
| ex ->
|
||||
printfn "%s" (ex.Message)
|
||||
None
|
||||
|
||||
let PRINT v =
|
||||
|
@ -105,9 +105,15 @@ module REPL
|
||||
try
|
||||
Some(eval env ast)
|
||||
with
|
||||
| Error.EvalError(msg)
|
||||
| Error.ReaderError(msg) ->
|
||||
printfn "%s" msg
|
||||
| Error.EvalError(str)
|
||||
| Error.ReaderError(str) ->
|
||||
printfn "%s" str
|
||||
None
|
||||
| Error.MalError(node) ->
|
||||
printfn "%s" (Printer.pr_str [node])
|
||||
None
|
||||
| ex ->
|
||||
printfn "%s" (ex.Message)
|
||||
None
|
||||
|
||||
let PRINT v =
|
||||
|
@ -105,9 +105,15 @@ module REPL
|
||||
try
|
||||
Some(eval env ast)
|
||||
with
|
||||
| Error.EvalError(msg)
|
||||
| Error.ReaderError(msg) ->
|
||||
printfn "%s" msg
|
||||
| Error.EvalError(str)
|
||||
| Error.ReaderError(str) ->
|
||||
printfn "%s" str
|
||||
None
|
||||
| Error.MalError(node) ->
|
||||
printfn "%s" (Printer.pr_str [node])
|
||||
None
|
||||
| ex ->
|
||||
printfn "%s" (ex.Message)
|
||||
None
|
||||
|
||||
let PRINT v =
|
||||
|
@ -125,8 +125,15 @@ module REPL
|
||||
try
|
||||
Some(eval env ast)
|
||||
with
|
||||
| Error.EvalError(msg) ->
|
||||
printfn "%s" msg
|
||||
| Error.EvalError(str)
|
||||
| Error.ReaderError(str) ->
|
||||
printfn "%s" str
|
||||
None
|
||||
| Error.MalError(node) ->
|
||||
printfn "%s" (Printer.pr_str [node])
|
||||
None
|
||||
| ex ->
|
||||
printfn "%s" (ex.Message)
|
||||
None
|
||||
|
||||
let PRINT v =
|
||||
|
@ -153,8 +153,15 @@ module REPL
|
||||
try
|
||||
Some(eval env ast)
|
||||
with
|
||||
| Error.EvalError(msg) ->
|
||||
printfn "%s" msg
|
||||
| Error.EvalError(str)
|
||||
| Error.ReaderError(str) ->
|
||||
printfn "%s" str
|
||||
None
|
||||
| Error.MalError(node) ->
|
||||
printfn "%s" (Printer.pr_str [node])
|
||||
None
|
||||
| ex ->
|
||||
printfn "%s" (ex.Message)
|
||||
None
|
||||
|
||||
let PRINT v =
|
||||
|
@ -170,8 +170,15 @@ module REPL
|
||||
try
|
||||
Some(eval env ast)
|
||||
with
|
||||
| Error.EvalError(msg) ->
|
||||
printfn "%s" msg
|
||||
| Error.EvalError(str)
|
||||
| Error.ReaderError(str) ->
|
||||
printfn "%s" str
|
||||
None
|
||||
| Error.MalError(node) ->
|
||||
printfn "%s" (Printer.pr_str [node])
|
||||
None
|
||||
| ex ->
|
||||
printfn "%s" (ex.Message)
|
||||
None
|
||||
|
||||
let PRINT v =
|
||||
|
@ -171,8 +171,15 @@ module REPL
|
||||
try
|
||||
Some(eval env ast)
|
||||
with
|
||||
| Error.EvalError(msg) ->
|
||||
printfn "%s" msg
|
||||
| Error.EvalError(str)
|
||||
| Error.ReaderError(str) ->
|
||||
printfn "%s" str
|
||||
None
|
||||
| Error.MalError(node) ->
|
||||
printfn "%s" (Printer.pr_str [node])
|
||||
None
|
||||
| ex ->
|
||||
printfn "%s" (ex.Message)
|
||||
None
|
||||
|
||||
let PRINT v =
|
||||
|
Loading…
Reference in New Issue
Block a user