Giter Site home page Giter Site logo

Comments (3)

XiaoningLiu avatar XiaoningLiu commented on June 7, 2024

@arichiardi Thanks for your feedback and suggestion about "make an option to chose what want to inject on".

Currently, every Azure Storage REST API defines expected response status codes, such as 200 or 202.
Other response codes will be treated as unexpected, which means something unexpected happens. A promise rejected will happen.

These unexpected responses needs careful attention to explicitly handled, Otherwise, some logical errors will be hidden and may resulting more unexpected behaviors hard to debug.

from azure-storage-js.

arichiardi avatar arichiardi commented on June 7, 2024

Thank you for answering! Yep that is exactly what happen and what I am debating.

The JS Promise rejections are a replacement of a catch clause that in this and many languages is a kind of error that interrupts the code flow and forces you to handle things, losing context usually.

In summary it should be used sparingly imho and not to control the program flow.

In my understanding a 304 is a normal condition that happens regularly if you cache, not an "exception". That is why it should not interrupt the control flow, aka, I would rather put that if in the .then.

from azure-storage-js.

XiaoningLiu avatar XiaoningLiu commented on June 7, 2024

@arichiardi Totally understand! Will discuss the details for the injection enhancement, as it's a potential 'big" change covering most of convenience layer methods. I'm afraid we cannot take this in recent changes. Do thanks to your valuable feedback.

We want to have a good balance between "easy coding" and "code quality". The default way about forcing handling all unexpected scenarios helps building up a robust application, but needs more coding efforts.

from azure-storage-js.

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.