bugsnag / bugsnag-react-native

Error monitoring and reporting tool for native exceptions and JS errors in React Native apps
https://docs.bugsnag.com/platforms/react-native
MIT License
370 stars 121 forks source link

Handled error reported as unhandled #382

Closed cristianoccazinsp closed 5 years ago

cristianoccazinsp commented 5 years ago

Description

Handled error reported as unhandled.

Issue

I have a very odd case where an exception thrown inside an async function (and handled somewhere else) is reported as unhandled by bugsnag on IOS. The application does not crash, and the error is definitely handled. Also, can't make this happen on Android at all.

Environment

Library versions:

react-native                      0.59.9
bugsnag-react-native              2.21.1   2.21.1

Sample code.


export async function sample(item, a=true, b=true){

    try{
        some code...
    }
    catch(err){
        let message = err.message;
        throw new Error(message);
    }

}

// later on...

let someFun = async () => {

    let tasks = pending.filter(item => item.priority).map(item => {
        try{
          return sample(item, true, true);
        }
        catch{
          errors++;
          return null;
        }
    });

    for(let t of tasks){
      try{
        if(t){
          await t;
        }
      }
      catch(err){
        errors++;
      }
    }
}

Error is reported as thrown at throw new Error(message);

abigailbramble commented 5 years ago

@cristianoccazinsp can you please write in to support@bugsnag.com with this? We would like to be able to look at this in your account and discuss your example in more detail.

cristianoccazinsp commented 5 years ago

Will do, thanks.

mattdyoung commented 5 years ago

Closing for now as we've been unable to reproduce. We'll re-open this if a reproduction example can be found.