Code Monkey home page Code Monkey logo

Comments (5)

stoiveyp avatar stoiveyp commented on June 16, 2024

Hi @ncipollina - thanks for raising your comment.

Because exception handling is an area where everyone has different opinions - the extension doesn't try and hide or wrap any exceptions. If you receive a 403 your skill code should be able to catch that WebException and deal with it accordingly.

There are error handlers within https://github.com/stoiveyp/Alexa.NET.RequestHandlers which can help isolate and maintain error logic, but if you have suggestions on a better way of handling that it'd be great to have a discussion on those.

from alexa.net.profile.

ncipollina avatar ncipollina commented on June 16, 2024

The problem is that HttpClient doesn't throw a WebException, it throws HttpRequestException, which does not include the status code.

from alexa.net.profile.

stoiveyp avatar stoiveyp commented on June 16, 2024

Ahh okay. If it's not part of the underlying exception given to us from .NET - I'm not sure I understand how we could return it consistently?

from alexa.net.profile.

ncipollina avatar ncipollina commented on June 16, 2024

I would handle it by calling the EnsureSuccessStatusCode method, and if the status is an error, return a custom exception with the status code. The consumer of the API could use that to know that it failed due to a permissions or other issue.

from alexa.net.profile.

stoiveyp avatar stoiveyp commented on June 16, 2024

At this point we're implementing a custom exception structure as well as altering the way we deal with the requests at an HttpClient level.

I'm happy to keep it as a future feature but short term I'd recommend using the custom client implementation (link below). Thanks for the information though.

https://github.com/stoiveyp/Alexa.NET.CustomerProfile/blob/master/Alexa.Net.CustomerProfile/CustomerProfileClient.cs#L31

from alexa.net.profile.

Related Issues (3)

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.