mirror of https://github.com/nealey/irc-bot
Handle parsing errors
This commit is contained in:
parent
33d30c694d
commit
d8ae40d6a7
8
bot.ml
8
bot.ml
|
@ -17,6 +17,7 @@ let write iobuf command args text =
|
|||
Iobuf.write iobuf cmd
|
||||
|
||||
let scheme_eval str =
|
||||
try
|
||||
let thread = Ocs_top.make_thread () in
|
||||
let env = Ocs_top.make_env () in
|
||||
let inport = Ocs_port.open_input_string str in
|
||||
|
@ -24,11 +25,12 @@ let scheme_eval str =
|
|||
let lexer = Ocs_lex.make_lexer inport "interactive" in
|
||||
let v = Ocs_read.read_expr lexer in
|
||||
let c = Ocs_compile.compile env v in
|
||||
try
|
||||
Ocs_eval.eval thread (Ocs_print.print outport false) c;
|
||||
Ocs_port.get_output_string outport
|
||||
with Ocs_error.Error msg ->
|
||||
msg
|
||||
with
|
||||
| Ocs_error.Error msg
|
||||
| Ocs_error.ErrorL (_, msg) ->
|
||||
"Error: " ^ msg
|
||||
|
||||
|
||||
let handle_privmsg iobuf sender target text =
|
||||
|
|
Loading…
Reference in New Issue