How to return Error signal with RxAlamorefire

Hi, I’m using RxAlamorefire to handler network request.

One of my problem is when I got json with format contain key “error” like : {error: “error message”} I need return onError signal instead of onNext to show alert view with the message.

//My code is something like this:
let obseverable = RxAlamofire.json(.get, url, parameters: nil, encoding: URLEncoding.default, headers: header)
.map { (json) → SomeObject? in
return Mapper().map(JSONObject: json)
=> // if json contain “error” should check and make “obseverable” emit error signal

What is an error signal? Which chapter introduces this term?

I need “observable” variable emit onError notification when I got json with format {“error”: “error message”} somehow. I’m from ReactiveCocoa to RxSwift so we use signal to description of next, error and completed events, maybe it not correct for RxSwift.

from within a flatMap, in case you receive that JSON, you can return a new observable like so: return Observable.error(myError) that will emit the error you want.

Can you pls write some code for understand?