I'm using RxAlamorefire to handle network task in my app.
My problem is: When I make a request and it return json. If json has a key "error" I need emit error notification instead of onNext notification.
My code is like this one:
let observable = RxAlamofire.json(.get, url, parameters: nil, encoding: URLEncoding.default, headers: header)
.map { (json) -> SomeObject? in
//Should check json maybe not in ".map" to see if the json contain "error" then emit onError notification.
return Mapper<SomeObject>().map(JSONObject: json)
}