Open spring-projects-issues opened 8 years ago
James Howe commented
This will probably require version 3.x of mongo-java-driver
Mark Paluch commented
The difficulty is staying compatible with both driver versions, 2.x and 3.x
James Howe commented
I'm also having similar issues with "Write failed with error code 100 and error message 'Not enough data-bearing nodes'".
Logically this would be the same as e.g. CassandraInsufficientReplicasAvailableException
, another transient issue
I don't think parsing the error message is the way to go here.
The MongoDB error_codes.yml holds a - RetriableError
category for against which we could compare the actual MongoException.getCode()
value.
James Howe opened DATAMONGO-1451 and commented
Currently all
WriteConcernException
are translated toDataIntegrityViolationException
, aNonTransientDataAccessException
.However, a write timeout also throws a
WriteConcernException
, for example:Logically (IMO) this case should instead be a
TransientDataAccessException
, perhaps a subclass ofTransientDataAccessResourceException
orQueryTimeoutException
. At least create aMongoWriteTimeoutException
so I can special-case it in exception handlers more easily.Unfortunately, the
WriteConcernException
doesn't appear to provide direct access to thewtimeout
property, so I guess you'd have to useex.getResponse()
.My end-goal: I want to return 503 from my controller when it times out, and 500 for other non-transient errors
Affects: 1.8.4 (Gosling SR4), 1.9.1 (Hopper SR1)
Referenced from: pull request https://github.com/spring-projects/spring-data-mongodb/pull/370
1 votes, 2 watchers