Handle idris errors
This commit is contained in:
parent
2784a7d80a
commit
525b9c68cd
|
@ -9,7 +9,7 @@ my $ide = IUtils::IDEMode.new();
|
|||
my @res = $ide.version;
|
||||
say @res[0][1][1][1][0];
|
||||
|
||||
@res = $ide.load-file: '.tmp/test.idr';
|
||||
@res = $ide.load-file: '.tmp/test.nope';
|
||||
say @res.raku;
|
||||
|
||||
@res = $ide.interpret: ':exec works >>= print';
|
||||
|
|
|
@ -43,11 +43,7 @@ class SExp::Actions {
|
|||
}
|
||||
|
||||
method str-content($/) {
|
||||
if $/.Str && $0 {
|
||||
make $/.Str.subst(/\\(.)/, {$0}, :g)
|
||||
} else {
|
||||
make ''
|
||||
}
|
||||
make $/.Str.subst(/\\(.)/, {$0}, :g)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +90,6 @@ method process-protocol-version() {
|
|||
method read-sexp() {
|
||||
my $len = $!socket.read(6).decode('utf8');
|
||||
my $msg = $!socket.read(:bin, $len.parse-base(16)).decode('utf8');
|
||||
# say "Got: ", $len, $msg;
|
||||
SExp.parse($msg, actions => SExp::Actions).made
|
||||
}
|
||||
|
||||
|
@ -119,7 +114,10 @@ method send-command(*@cmd) {
|
|||
my $resp = self.read-sexp();
|
||||
@responses.push($resp);
|
||||
|
||||
# TODO: Die on error
|
||||
if $resp[1][0] eq ':error' && $resp[2] == $id {
|
||||
die "Idris error: ", $resp[1][1];
|
||||
}
|
||||
|
||||
if $resp[0] eq ':return' && $resp[2] == $id {
|
||||
return @responses;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue