Code Monkey home page Code Monkey logo

Comments (6)

maca88 avatar maca88 commented on September 17, 2024 1

In my opinion we should apply the same idea as for guards/preconditions where we want to fail at the spot without the need to await the call. But after a quick look on the internet I found this, where nobody mentioned the option to only throw the raw exception without wrapping it into a task. Currently I fixed this by throwing a raw exception but I will leave the issue open and do a deeper research about this.

from asyncgenerator.

maca88 avatar maca88 commented on September 17, 2024

The same problem could apply also for NotSupportedException and other exceptions, so I think that we shall not wrap into a try/catch block when the first statement is a throw statement.

from asyncgenerator.

hazzik avatar hazzik commented on September 17, 2024

Agree. The NotImplementedException was just an example. I was to lazy to write about other exceptions:)

from asyncgenerator.

hazzik avatar hazzik commented on September 17, 2024

Shall it be just a throw or return Task.FromException(...)?

from asyncgenerator.

hazzik avatar hazzik commented on September 17, 2024

From this it looks like

    public async Task X2Async() {
        throw new NotImplementedException();
    }

Is really overcomplicated version of this:

    public Task X3Async() {
		return Task.FromException(new NotImplementedException());
    }

from asyncgenerator.

hazzik avatar hazzik commented on September 17, 2024

As far as I concern the 87643c8 has fixed this issue.

from asyncgenerator.

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.