split error and raise
This commit is contained in:
parent
54c0ded876
commit
6e3a2b176a
18
src/error.c
18
src/error.c
|
@ -18,6 +18,17 @@ pic_errmsg(pic_state *pic)
|
||||||
return pic->err->msg->str;
|
return pic->err->msg->str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NORETURN static void
|
||||||
|
raise(pic_state *pic, struct pic_error *e)
|
||||||
|
{
|
||||||
|
pic->err = e;
|
||||||
|
if (! pic->jmp) {
|
||||||
|
puts(pic_errmsg(pic));
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
longjmp(*pic->jmp, 1);
|
||||||
|
}
|
||||||
|
|
||||||
NORETURN static void
|
NORETURN static void
|
||||||
error(pic_state *pic, struct pic_string *msg, pic_value irrs)
|
error(pic_state *pic, struct pic_string *msg, pic_value irrs)
|
||||||
{
|
{
|
||||||
|
@ -28,12 +39,7 @@ error(pic_state *pic, struct pic_string *msg, pic_value irrs)
|
||||||
e->msg = msg;
|
e->msg = msg;
|
||||||
e->irrs = irrs;
|
e->irrs = irrs;
|
||||||
|
|
||||||
pic->err = e;
|
raise(pic, e);
|
||||||
if (! pic->jmp) {
|
|
||||||
puts(pic_errmsg(pic));
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
longjmp(*pic->jmp, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue