Skip to content

Commit

Permalink
More Exceptions as Serializeable.
Browse files Browse the repository at this point in the history
  • Loading branch information
lanwin committed May 21, 2010
1 parent 5f3f6cb commit 8c9106f
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 24 deletions.
54 changes: 30 additions & 24 deletions source/MongoDB/Exceptions/MongoCommandException.cs
Expand Up @@ -3,42 +3,48 @@
namespace MongoDB
{
/// <summary>
/// Raised when a command returns a failure message.
/// Raised when a command returns a failure message.
/// </summary>
[Serializable]
public class MongoCommandException : MongoException
{
/// <summary>
/// Gets or sets the error.
/// Initializes a new instance of the <see cref = "MongoCommandException" /> class.
/// </summary>
/// <value>The error.</value>
public Document Error { get; private set; }
/// <param name = "message">The message.</param>
/// <param name = "error">The error.</param>
/// <param name = "command">The command.</param>
public MongoCommandException(string message, Document error, Document command)
: base(message, null)
{
Error = error;
Command = command;
}

/// <summary>
/// Gets or sets the command.
/// Initializes a new instance of the <see cref = "MongoCommandException" /> class.
/// </summary>
/// <value>The command.</value>
public Document Command { get; private set; }
/// <param name = "message">The message.</param>
/// <param name = "error">The error.</param>
/// <param name = "command">The command.</param>
/// <param name = "e">The e.</param>
public MongoCommandException(string message, Document error, Document command, Exception e)
: base(message, e)
{
Error = error;
Command = command;
}

/// <summary>
/// Initializes a new instance of the <see cref="MongoCommandException"/> class.
/// Gets or sets the error.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="error">The error.</param>
/// <param name="command">The command.</param>
public MongoCommandException(string message, Document error, Document command):base(message,null){
this.Error = error;
this.Command = command;
}
/// <value>The error.</value>
public Document Error { get; private set; }

/// <summary>
/// Initializes a new instance of the <see cref="MongoCommandException"/> class.
/// Gets or sets the command.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="error">The error.</param>
/// <param name="command">The command.</param>
/// <param name="e">The e.</param>
public MongoCommandException(string message, Document error, Document command, Exception e):base(message,e){
this.Error = error;
this.Command = command;
}
/// <value>The command.</value>
public Document Command { get; private set; }
}
}
1 change: 1 addition & 0 deletions source/MongoDB/Exceptions/MongoConnectionException.cs
Expand Up @@ -6,6 +6,7 @@ namespace MongoDB
/// <summary>
///
/// </summary>
[Serializable]
public class MongoConnectionException : MongoException
{
/// <summary>
Expand Down
1 change: 1 addition & 0 deletions source/MongoDB/Exceptions/MongoDuplicateKeyException.cs
Expand Up @@ -5,6 +5,7 @@ namespace MongoDB
/// <summary>
/// Raised when an action causes a unique constraint violation in an index.
/// </summary>
[Serializable]
public class MongoDuplicateKeyException : MongoOperationException
{
/// <summary>
Expand Down
Expand Up @@ -8,6 +8,7 @@ namespace MongoDB
/// <remarks>
/// It is only another class because Mongo makes a distinction and it may be helpful.
/// </remarks>
[Serializable]
public class MongoDuplicateKeyUpdateException : MongoDuplicateKeyException
{
/// <summary>
Expand Down
1 change: 1 addition & 0 deletions source/MongoDB/Exceptions/MongoException.cs
Expand Up @@ -5,6 +5,7 @@ namespace MongoDB
/// <summary>
/// Base class for all Mongo Exceptions
/// </summary>
[Serializable]
public class MongoException : Exception
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions source/MongoDB/Exceptions/MongoMapReduceException.cs
@@ -1,10 +1,12 @@
using System;
using MongoDB.Results;

namespace MongoDB
{
/// <summary>
/// Raised when a map reduce call fails.
/// </summary>
[Serializable]
public class MongoMapReduceException : MongoCommandException
{
/// <summary>
Expand Down
1 change: 1 addition & 0 deletions source/MongoDB/Exceptions/MongoOperationException.cs
Expand Up @@ -5,6 +5,7 @@ namespace MongoDB
/// <summary>
///
/// </summary>
[Serializable]
public class MongoOperationException : MongoException
{
/// <summary>
Expand Down

0 comments on commit 8c9106f

Please sign in to comment.