Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

244
Views
Realm JS Try...Catch block returns both error and success promises

When the code below is executed with the correct values, the object is deleted and the function returns both "Success" and "Error: object must be of type 'object', got (undefined)". So, the function is working because it deletes the object, but I shouldn't be getting any error message.

this.del = async function (arg1, arg2) {
    openR = openRealm(arg1);
    const realm = await Realm.open(openR);
    try {
    realm.write(() => {
    const del = realm.objectForPrimaryKey(openR.schema[0].name, arg2);
    realm.delete(del);
    });
    } catch(e) {
    return Promise.resolve(e);
}   
    return Promise.resolve("Success");  
    }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The problem isn't with the code. It's just React Native reloading the component after the promise is resolved, and so calling the function again.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!