Git Product home page Git Product logo

Comments (6)

denniseffing avatar denniseffing commented on June 25, 2024

I got the exact same problem, also using version 2.1.

Is there any update on this?

from alamofireobjectmapper.

tristanhimmelman avatar tristanhimmelman commented on June 25, 2024

I'm not sure why this would be happening...

See the two Response serializers below (they both return the Alamofire error immediately if it exists):
https://github.com/tristanhimmelman/AlamofireObjectMapper/blob/master/AlamofireObjectMapper/AlamofireObjectMapper.swift#L38
https://github.com/tristanhimmelman/AlamofireObjectMapper/blob/master/AlamofireObjectMapper/AlamofireObjectMapper.swift#L107

What kind of error are you expecting to see that is not returned?

You might want to inspect the NSHTTPURLResponse (response.response) to get the statusCode and NSData that was returned from the request

from alamofireobjectmapper.

AlejandroOrozco avatar AlejandroOrozco commented on June 25, 2024

Yeah i have the same problem, it only retrieves the error of "The operation couldn’t be completed. ObjectMapper failed to serialize response". Could it be posible that the callback is retrieving the success or the failure of the objectmapper action
instead of the request?

By example, at a service is retrieving me 500 status error code but the function keeps going to the success case.

captura de pantalla 2016-01-04 a las 6 14 58 p m

Is there any other way to get the status code or the error message?

from alamofireobjectmapper.

tristanhimmelman avatar tristanhimmelman commented on June 25, 2024

After some research it turns out this is a feature of Alamofire. To get the error, you need to call the validate() function on the request. See the Alamofire docs: https://github.com/Alamofire/Alamofire#validation

from alamofireobjectmapper.

AlejandroOrozco avatar AlejandroOrozco commented on June 25, 2024

Thank so much, now it works as expected.

from alamofireobjectmapper.

santhoshs5 avatar santhoshs5 commented on June 25, 2024

I am having the same issue i could not retrive the status as expected.

Alamofire.upload(data!, with: (myrouter)
.uploadProgress { progress in // main queue by default
// print("Upload Progress: (progress.fractionCompleted)")
}.validate()
.responseJSON { [weak self] response in{

// what can i put here so that i can retrive the status code like 200 or 500
NSURLErrorCannotFindHost
NSURLErrorNetworkConnectionLost

}

from alamofireobjectmapper.

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.