emit more friendly error message on error from piclib loader
This commit is contained in:
parent
21c12e9fe5
commit
fccb4b16ea
|
@ -41,7 +41,9 @@ pic_load_piclib(pic_state *pic)
|
|||
EOL
|
||||
|
||||
foreach my $file (@ARGV) {
|
||||
print " pic_try {\n";
|
||||
print <<EOL;
|
||||
pic_try {
|
||||
EOL
|
||||
my $var = &escape_v($file);
|
||||
my $basename = basename($file);
|
||||
my $dirname = basename(dirname($file));
|
||||
|
@ -51,8 +53,7 @@ foreach my $file (@ARGV) {
|
|||
pic_catch {
|
||||
/* error! */
|
||||
xfputs(pic, "fatal error: failure in loading $dirname/$basename\\n", xstderr);
|
||||
xfputs(pic, pic_errmsg(pic), xstderr);
|
||||
pic_panic(pic, "load error");
|
||||
pic_raise(pic, pic->err);
|
||||
}
|
||||
EOL
|
||||
}
|
||||
|
|
|
@ -44,11 +44,11 @@ main(int argc, char *argv[], char **envp)
|
|||
pic = pic_open(pic_default_allocf, NULL);
|
||||
pic_set_argv(pic, argc, argv, envp);
|
||||
|
||||
pic_init_picrin(pic);
|
||||
|
||||
PICRIN_MAIN = pic_find_library(pic, pic_read_cstr(pic, "(picrin main)"));
|
||||
|
||||
pic_try {
|
||||
pic_init_picrin(pic);
|
||||
|
||||
PICRIN_MAIN = pic_find_library(pic, pic_read_cstr(pic, "(picrin main)"));
|
||||
|
||||
pic_funcall(pic, PICRIN_MAIN, "main", pic_nil_value());
|
||||
}
|
||||
pic_catch {
|
||||
|
|
Loading…
Reference in New Issue