From: Matt S Trout Date: Sat, 27 Feb 2016 21:24:40 +0000 (+0000) Subject: make protoshell handle errors X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=03fafee934b0f650425503bf3ce31258584f93cd;p=scpubgit%2FDX.git make protoshell handle errors --- diff --git a/bin/protoshell b/bin/protoshell index af58203..e93ee68 100644 --- a/bin/protoshell +++ b/bin/protoshell @@ -2,6 +2,7 @@ use strictures 2; use Module::Runtime qw(use_module); use DX::Utils qw(dict deparse); use Devel::Dwarn; +use Try::Tiny; BEGIN { *u = \&use_module } my $scope = u('DX::Scope')->new( @@ -28,5 +29,10 @@ foreach my $pred (keys %{$scope->predicates}) { my $rl = u('Caroline')->new; while (my $line = $rl->readline('$ ')) { - $tcl->Eval($line); + try { + $tcl->Eval($line); + } catch { + warn "Eval error: $_"; + }; + $rl->history_add($line); }