Giter VIP home page Giter VIP logo

Comments (2)

jerbob92 avatar jerbob92 commented on June 2, 2024

Hey!

At this moment, I don't think it's possible to get the original native error. I'm also not sure whether NativeScript has something to provide in that. It's probably better to transform these errors in the plugin to standardized TypeScript errors.
I would accept Pull Requests for that.

from nativescript-http.

dpattou avatar dpattou commented on June 2, 2024

Thanks for the answer.

We cannot get the actual native error indeed, I meant the 'wrapped' Javascript version.

On iOS the error returned by session.dataTaskWithRequestCompletionHandler(urlRequest, function (data, response, error) {...} seems to be a 'wrapped' Javascript NSError. On Android though, I'm not sure what errors are mapped to (probably some subclass of a java Exception ?).

I guess it would be somewhat complicated to map iOS NSErrors and Android Exceptions to various error types (no network, timeout etc...) but it might be nice to have a way to retrieve the 'original' (but not native :) ) error.

I'm not super familiar with TypeScript errors, but it looks like one would have to create a subclass for that ? (And add an nativeError / underlyingError property to the Error class).

I don't have a lot of time to delve more into this right now but may try to make a pull request later.

from nativescript-http.

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.