Skip to content

Commit

Permalink
Various custom exceptions are now cross-appdomain friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
abolibibelot committed Jul 6, 2010
1 parent 90eaeb0 commit e3863d1
Show file tree
Hide file tree
Showing 9 changed files with 151 additions and 1 deletion.
16 changes: 16 additions & 0 deletions source/MongoDB/Exceptions/IdGenerationException.cs
@@ -1,4 +1,5 @@
using System;
using System.Runtime.Serialization;

namespace MongoDB
{
Expand All @@ -13,5 +14,20 @@ public class IdGenerationException : MongoException
/// </summary>
/// <param name="message">The message.</param>
public IdGenerationException(string message) : base(message) { }

/// <summary>
/// Initializes a new instance of the <see cref="IdGenerationException"/> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="info"/> parameter is null.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
/// </exception>
public IdGenerationException(SerializationInfo info, StreamingContext context) : base(info,context)
{
}
}
}
16 changes: 16 additions & 0 deletions source/MongoDB/Exceptions/MongoCommandException.cs
@@ -1,4 +1,5 @@
using System;
using System.Runtime.Serialization;

namespace MongoDB
{
Expand Down Expand Up @@ -35,6 +36,21 @@ public MongoCommandException(string message, Document error, Document command, E
Command = command;
}

/// <summary>
/// Initializes a new instance of the <see cref="MongoCommandException"/> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="info"/> parameter is null.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
/// </exception>
public MongoCommandException(SerializationInfo info, StreamingContext context) : base(info,context)
{
}

/// <summary>
/// Gets or sets the error.
/// </summary>
Expand Down
19 changes: 18 additions & 1 deletion source/MongoDB/Exceptions/MongoConnectionException.cs
@@ -1,4 +1,5 @@
using System;
using System.Runtime.Serialization;
using MongoDB.Connections;

namespace MongoDB
Expand Down Expand Up @@ -65,6 +66,22 @@ internal MongoConnectionException(string message, Connection connection, Excepti
throw new ArgumentNullException("connection");
ConnectionString = connection.ConnectionString;
EndPoint = connection.EndPoint;
}
}

/// <summary>
/// Initializes a new instance of the <see cref="MongoConnectionException"/> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="info"/> parameter is null.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
/// </exception>
public MongoConnectionException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
17 changes: 17 additions & 0 deletions source/MongoDB/Exceptions/MongoDuplicateKeyException.cs
@@ -1,4 +1,5 @@
using System;
using System.Runtime.Serialization;

namespace MongoDB
{
Expand All @@ -22,5 +23,21 @@ public class MongoDuplicateKeyException : MongoOperationException
/// <param name="error">The error.</param>
/// <param name="e">The e.</param>
public MongoDuplicateKeyException(string message, Document error, Exception e):base(message, error,e){}

/// <summary>
/// Initializes a new instance of the <see cref="MongoDuplicateKeyException"/> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="info"/> parameter is null.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
/// </exception>
public MongoDuplicateKeyException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
17 changes: 17 additions & 0 deletions source/MongoDB/Exceptions/MongoDuplicateKeyUpdateException.cs
@@ -1,4 +1,5 @@
using System;
using System.Runtime.Serialization;

namespace MongoDB
{
Expand Down Expand Up @@ -26,5 +27,21 @@ public MongoDuplicateKeyUpdateException(string message, Document error)
/// <param name="error">The error.</param>
/// <param name="e">The e.</param>
public MongoDuplicateKeyUpdateException(string message, Document error, Exception e):base(message, error,e){}

/// <summary>
/// Initializes a new instance of the <see cref="MongoDuplicateKeyUpdateException"/> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="info"/> parameter is null.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
/// </exception>
public MongoDuplicateKeyUpdateException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
16 changes: 16 additions & 0 deletions source/MongoDB/Exceptions/MongoException.cs
@@ -1,4 +1,5 @@
using System;
using System.Runtime.Serialization;

namespace MongoDB
{
Expand All @@ -20,5 +21,20 @@ public class MongoException : Exception
/// </summary>
/// <param name="message">The message.</param>
public MongoException(string message):base(message){}

/// <summary>
/// Initializes a new instance of the <see cref="MongoException"/> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="info"/> parameter is null.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
/// </exception>
public MongoException(SerializationInfo info, StreamingContext context) : base(info,context)
{
}
}
}
17 changes: 17 additions & 0 deletions source/MongoDB/Exceptions/MongoMapReduceException.cs
@@ -1,4 +1,5 @@
using System;
using System.Runtime.Serialization;
using MongoDB.Results;

namespace MongoDB
Expand All @@ -23,5 +24,21 @@ public MongoMapReduceException(MongoCommandException exception)
:base(exception.Message,exception.Error, exception.Command) {
MapReduceResult = new MapReduceResult(exception.Error);
}

/// <summary>
/// Initializes a new instance of the <see cref="MongoMapReduceException"/> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="info"/> parameter is null.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
/// </exception>
public MongoMapReduceException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
17 changes: 17 additions & 0 deletions source/MongoDB/Exceptions/MongoOperationException.cs
@@ -1,4 +1,5 @@
using System;
using System.Runtime.Serialization;

namespace MongoDB
{
Expand Down Expand Up @@ -29,6 +30,22 @@ public class MongoOperationException : MongoException
/// <param name="e">The e.</param>
public MongoOperationException(string message, Document error, Exception e):base(message,e){
this.Error = error;
}

/// <summary>
/// Initializes a new instance of the <see cref="MongoOperationException"/> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="info"/> parameter is null.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
/// </exception>
public MongoOperationException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}
17 changes: 17 additions & 0 deletions source/MongoDB/Exceptions/UnmappedMemberException.cs
@@ -1,4 +1,5 @@
using System;
using System.Runtime.Serialization;

namespace MongoDB
{
Expand All @@ -13,5 +14,21 @@ public class UnmappedMemberException : MongoException
/// </summary>
/// <param name="message">The message.</param>
public UnmappedMemberException(string message) : base(message) { }

/// <summary>
/// Initializes a new instance of the <see cref="UnmappedMemberException"/> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"/> that contains contextual information about the source or destination.</param>
/// <exception cref="T:System.ArgumentNullException">
/// The <paramref name="info"/> parameter is null.
/// </exception>
/// <exception cref="T:System.Runtime.Serialization.SerializationException">
/// The class name is null or <see cref="P:System.Exception.HResult"/> is zero (0).
/// </exception>
public UnmappedMemberException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
}
}

0 comments on commit e3863d1

Please sign in to comment.