File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ sub boot {
210210 $boot ++;
211211 $: :VERSION = $VERSION ;
212212 $: :notice_warnings = 1;
213+ $: :notice_dies = 1;
213214
214215 # load mandatory boot stuff
215216 require POSIX;
@@ -281,7 +282,9 @@ sub startup_error {
281282
282283# loop indefinitely
283284sub loop {
284- $loop -> loop_forever;
285+ while (!eval { $loop -> loop_once(undef ); 1 }) {
286+ notice(event_loop_error => $@ || ' unknown error occurred in the event loop' );
287+ }
285288}
286289
287290# ##################################
@@ -1088,11 +1091,21 @@ sub WARNING {
10881091 my $warn = shift ;
10891092 return if $disable_warnings ;
10901093 chomp $warn ;
1091- ircd-> can(' notice ' ) && $: :notice_warnings ?
1092- notice (perl_warning => $warn ) :
1094+ ircd-> can(' gnotice ' ) && $: :notice_warnings ?
1095+ gnotice (perl_warning => $warn ) :
10931096 L($warn );
10941097}
10951098
1099+ # handle uncaught exceptions
1100+ sub DIE {
1101+ my $err = shift ;
1102+ return if $^S; # don't catch during eval
1103+ chomp $err ;
1104+ ircd-> can(' gnotice' ) && $: :notice_dies ?
1105+ gnotice(exception => " DIE: $err " ) :
1106+ L(" uncaught exception: $err " );
1107+ }
1108+
10961109# ##############
10971110# ## LOGGING ###
10981111# ##############
You can’t perform that action at this time.
0 commit comments