Giter Site home page Giter Site logo

Comments (4)

R4md4c avatar R4md4c commented on May 18, 2024 2

Hope PR #74 gets merged and release soon as we've been suffering from this crash in production.

I think it's more reproducible when dealing with coroutines where sometimes a CancellationException is thrown due to the CoroutineScope of the current suspend method gets cancelled, and since in the mapError we're expecting our custom domain exception class it crashes instead due to ClassCastException.

Example:

remoteDataSource.retrieveFromDataSource() // Returns a SuspendableResult<Data, DataSourceException> 
    .mapError { exception: DataSourceException  ->   } // Crashes here because a JobCancellationException was thrown but we're expecting a DataSourceException

from result.

krzykrucz avatar krzykrucz commented on May 18, 2024

This happens in case of Result as well. It would be better not to handle these exceptions at all. Because ClassCastException in the least expected moment at runtime is not a good thing, in my opinion.

What do you think @kittinunf ?

from result.

kittinunf avatar kittinunf commented on May 18, 2024

To be honest, I am reluctant to add this functionality. Do you think you can have a top-level exception that every other error conforms too and use that one instead?

from result.

kittinunf avatar kittinunf commented on May 18, 2024

It has been merged quite some time ago! Please report it back whether it solves the problem or not.

from result.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.