Skip to content

Commit 2ed798f

Browse files
committed
JAVA-757: Made CommandFailureException public. Added Javadoc
1 parent 7897a3b commit 2ed798f

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/main/com/mongodb/CommandFailureException.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717

1818
package com.mongodb;
1919

20-
class CommandFailureException extends MongoException {
21-
private static final long serialVersionUID = 1L;
20+
/**
21+
* An exception indicating a failed command.
22+
*/
23+
public class CommandFailureException extends MongoException {
24+
private static final long serialVersionUID = -1180715413196161037L;
2225
private final CommandResult commandResult;
2326

2427
/**
28+
* Construct a new instance with the CommandResult from a failed command
2529
*
2630
* @param commandResult the result
2731
*/
@@ -30,6 +34,11 @@ public CommandFailureException(CommandResult commandResult){
3034
this.commandResult = commandResult;
3135
}
3236

37+
/**
38+
* Gets the getlasterror command result document.
39+
*
40+
* @return the command result
41+
*/
3342
public CommandResult getCommandResult() {
3443
return commandResult;
3544
}

src/main/com/mongodb/WriteConcernException.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public class WriteConcernException extends MongoException {
2626

2727
private final CommandResult commandResult;
2828

29+
/**
30+
* Construct a new instance with the CommandResult from getlasterror command
31+
*
32+
* @param commandResult the command result
33+
*/
2934
public WriteConcernException(final CommandResult commandResult) {
3035
super(commandResult.getCode(), commandResult.toString());
3136
this.commandResult = commandResult;

0 commit comments

Comments
 (0)