BsonSerializationException.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Copyright 2010-present MongoDB Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. using System;
  16. #if NET452
  17. using System.Runtime.Serialization;
  18. #endif
  19. namespace MongoDB.Bson
  20. {
  21. /// <summary>
  22. /// Represents a BSON serialization exception.
  23. /// </summary>
  24. #if NET452
  25. [Serializable]
  26. #endif
  27. public class BsonSerializationException : BsonException
  28. {
  29. // constructors
  30. /// <summary>
  31. /// Initializes a new instance of the BsonSerializationException class.
  32. /// </summary>
  33. public BsonSerializationException()
  34. : base()
  35. {
  36. }
  37. /// <summary>
  38. /// Initializes a new instance of the BsonSerializationException class.
  39. /// </summary>
  40. /// <param name="message">The error message.</param>
  41. public BsonSerializationException(string message)
  42. : base(message)
  43. {
  44. }
  45. /// <summary>
  46. /// Initializes a new instance of the BsonSerializationException class.
  47. /// </summary>
  48. /// <param name="message">The error message.</param>
  49. /// <param name="innerException">The inner exception.</param>
  50. public BsonSerializationException(string message, Exception innerException)
  51. : base(message, innerException)
  52. {
  53. }
  54. #if NET452
  55. /// <summary>
  56. /// Initializes a new instance of the BsonSerializationException class (this overload used by deserialization).
  57. /// </summary>
  58. /// <param name="info">The SerializationInfo.</param>
  59. /// <param name="context">The StreamingContext.</param>
  60. public BsonSerializationException(SerializationInfo info, StreamingContext context)
  61. : base(info, context)
  62. {
  63. }
  64. #endif
  65. }
  66. }