@@ -452,16 +452,12 @@ public boolean notify(Report report, Callback reportCallback) {
452452 return false ;
453453 }
454454
455- // Run all client-wide beforeNotify callbacks
455+ // Run all client-wide onError callbacks
456456 for (Callback callback : config .callbacks ) {
457457 try {
458- // Run the callback
459- callback .beforeNotify (report );
460-
461- // Check if callback cancelled delivery
462- if (report .getShouldCancel ()) {
463- LOGGER .debug ("Error not reported to Bugsnag - "
464- + "cancelled by a client-wide beforeNotify callback" );
458+ boolean proceed = callback .onError (report );
459+ if (!proceed || report .getShouldCancel ()) {
460+ LOGGER .debug ("Error not reported to Bugsnag - cancelled by a client-wide onError callback" );
465461 return false ;
466462 }
467463 } catch (Throwable ex ) {
@@ -472,16 +468,12 @@ public boolean notify(Report report, Callback reportCallback) {
472468 // Add thread metadata to the report
473469 report .mergeMetadata (THREAD_METADATA .get ());
474470
475- // Run the report-specific beforeNotify callback, if given
471+ // Run the report-specific onError callback, if given
476472 if (reportCallback != null ) {
477473 try {
478- // Run the callback
479- reportCallback .beforeNotify (report );
480-
481- // Check if callback cancelled delivery
482- if (report .getShouldCancel ()) {
483- LOGGER .debug (
484- "Error not reported to Bugsnag - cancelled by a report-specific callback" );
474+ boolean proceed = reportCallback .onError (report );
475+ if (!proceed || report .getShouldCancel ()) {
476+ LOGGER .debug ("Error not reported to Bugsnag - cancelled by a report-specific callback" );
485477 return false ;
486478 }
487479 } catch (Throwable ex ) {
@@ -676,7 +668,7 @@ public static Set<Bugsnag> uncaughtExceptionClients() {
676668 return Collections .emptySet ();
677669 }
678670
679- void addBeforeSendSession ( BeforeSendSession beforeSendSession ) {
680- sessionTracker .addBeforeSendSession ( beforeSendSession );
671+ void addOnSession ( OnSession onSession ) {
672+ sessionTracker .addOnSession ( onSession );
681673 }
682674}
0 commit comments