Package com.mongodb

Class WriteError

  • Direct Known Subclasses:
    BulkWriteError


    public class WriteError
    extends java.lang.Object
    Represents the details of a write error , e.g. a duplicate key error
    Since:
    3.0
    • Constructor Summary

      Constructors 
      Constructor Description
      WriteError​(int code, java.lang.String message, org.bson.BsonDocument details)
      Constructs a new instance.
      WriteError​(WriteError writeError)
      Construct an instance that is a shallow copy of the given instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      ErrorCategory getCategory​()
      Gets the category of this error.
      int getCode​()
      Gets the code associated with this error.
      org.bson.BsonDocument getDetails​()
      Gets the details associated with this error.
      java.lang.String getMessage​()
      Gets the message associated with this error.
      int hashCode​()  
      java.lang.String toString​()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • WriteError

        public WriteError​(int code,
                          java.lang.String message,
                          org.bson.BsonDocument details)
        Constructs a new instance.
        Parameters:
        code - the error code
        message - the error message
        details - details about the error
      • WriteError

        public WriteError​(WriteError writeError)
        Construct an instance that is a shallow copy of the given instance.
        Parameters:
        writeError - the write error to copy
    • Method Detail

      • getCategory

        public ErrorCategory getCategory​()
        Gets the category of this error.
        Returns:
        the category of this write error
      • getCode

        public int getCode​()
        Gets the code associated with this error.
        Returns:
        the code
      • getMessage

        public java.lang.String getMessage​()
        Gets the message associated with this error.
        Returns:
        the message
      • getDetails

        public org.bson.BsonDocument getDetails​()
        Gets the details associated with this error. This document will not be null, but may be empty.
        Returns:
        the details
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode​()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString​()
        Overrides:
        toString in class java.lang.Object