Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

245
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda