Skip to content

Commit

Permalink
JAVA-757: Made CommandFailureException public. Added Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
jyemin committed Feb 22, 2013
1 parent 7897a3b commit 2ed798f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/com/mongodb/CommandFailureException.java
Expand Up @@ -17,11 +17,15 @@


package com.mongodb; package com.mongodb;


class CommandFailureException extends MongoException { /**
private static final long serialVersionUID = 1L; * An exception indicating a failed command.
*/
public class CommandFailureException extends MongoException {
private static final long serialVersionUID = -1180715413196161037L;
private final CommandResult commandResult; private final CommandResult commandResult;


/** /**
* Construct a new instance with the CommandResult from a failed command
* *
* @param commandResult the result * @param commandResult the result
*/ */
Expand All @@ -30,6 +34,11 @@ public CommandFailureException(CommandResult commandResult){
this.commandResult = commandResult; this.commandResult = commandResult;
} }


/**
* Gets the getlasterror command result document.
*
* @return the command result
*/
public CommandResult getCommandResult() { public CommandResult getCommandResult() {
return commandResult; return commandResult;
} }
Expand Down
5 changes: 5 additions & 0 deletions src/main/com/mongodb/WriteConcernException.java
Expand Up @@ -26,6 +26,11 @@ public class WriteConcernException extends MongoException {


private final CommandResult commandResult; private final CommandResult commandResult;


/**
* Construct a new instance with the CommandResult from getlasterror command
*
* @param commandResult the command result
*/
public WriteConcernException(final CommandResult commandResult) { public WriteConcernException(final CommandResult commandResult) {
super(commandResult.getCode(), commandResult.toString()); super(commandResult.getCode(), commandResult.toString());
this.commandResult = commandResult; this.commandResult = commandResult;
Expand Down

0 comments on commit 2ed798f

Please sign in to comment.