-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Dev Exp
-
None
When authentication fails I get the following exception message currently:
> Mongo::Auth::Unauthorized (User foo (mechanism: aws) is not authorized to access test (auth source: $external, used mechanism: MONGODB-AWS, used server: localhost:14421 (PRIMARY)): Received authentication for mechanism MONGODB-AWS which is unknown or not enabled (2: BadValue) (on localhost:14421))
Here, I expect that (2: BadValue) is part of the server-generated message since the driver doesn't have a mapping from codes to code names.
Here is an exception message produced for OperationFailure for comparison:
> Mongo::Error::OperationFailure (no such command: 'pingx' (59) (on localhost:14421))
In this message, 59 is the code returned by the server but the formatting of 59 in the parentheses is supplied by the driver, and the server-supplied text is just "no such command: 'pingx'".
We should clearly indicate in exception messages produced by the driver which part of the message came from the server and which part was composed by the driver.