Github user emlaver commented on a diff in the pull request:
https://github.com/apache/bahir/pull/60#discussion_r159722257
--- Diff:
sql-cloudant/src/main/scala/org/apache/bahir/cloudant/internal/ChangesReceiver.scala
---
@@ -72,6 +72,7 @@ class ChangesReceiver(config: CloudantChangesConfig)
val status = headers.getOrElse("Status", IndexedSeq.empty)
val errorMsg = "Error retrieving _changes feed " +
config.getDbname + ": " + status(0)
reportError(errorMsg, new CloudantException(errorMsg))
+ stop(errorMsg)
--- End diff --
Yes, when testing with `spark-submit` command you would see two additional
error messages. First message below is from `reportError`, and the other two
are from `stop`:
```
...
18/01/04 13:04:11 WARN ReceiverSupervisorImpl: Reported error Error
retrieving _changes feed animaldb: HTTP/1.1 401 Unauthorized -
org.apache.bahir.cloudant.common.CloudantException: Error retrieving _changes
feed animaldb: HTTP/1.1 401 Unauthorized
...
18/01/04 13:04:11 INFO ReceiverSupervisorImpl: Stopping receiver with
message: Error retrieving _changes feed animaldb: HTTP/1.1 401 Unauthorized:
...
18/01/04 13:04:11 ERROR ReceiverTracker: Deregistered receiver for stream
0: Error retrieving _changes feed animaldb: HTTP/1.1 401 Unauthorized
```
Since we already call `stop` [in
DefaultSource](https://github.com/apache/bahir/pull/60/files#diff-4a0eb687595fe14565677d020371b69eR154),
I'll remove this line.
I will also be changing [this error
message](https://github.com/apache/bahir/pull/60/files#diff-4a0eb687595fe14565677d020371b69eR165)
as it's more likely an HTTP error happened. For users running with
`spark-submit`, they will get logging in the console. There will be limited or
no logging in DSX which means it might be worth passing the HTTP error message
to `CloudantException`.
---