Exemple #1
0
 /// <summary>
 /// 初始化 <see cref="RepositoryException"/> 类的新实例。
 /// </summary>
 /// <param name="ex">引发当前异常的 <see cref="MongoException"/> 异常。</param>
 public RepositoryException(MongoException ex)
     : base(RepositoryExceptionMessage, ex)
 {
     if (ex is MongoWriteException writeException)
     {
         ErrorCode = RepositoryErrorCodeHelper.FromMongoServerErrorCategory(writeException.WriteError.Category);
     }
     else
     {
         ErrorCode = RepositoryErrorCode.Unknown;
     }
 }
Exemple #2
0
 /// <summary>
 /// 初始化 <see cref="RepositoryException"/> 类的新实例。
 /// </summary>
 /// <param name="errorCode">错误码。</param>
 public RepositoryException(RepositoryErrorCode errorCode)
     : base(RepositoryExceptionMessage)
 {
     ErrorCode = errorCode;
 }