Beispiel #1
0
 public ServerException(ServiceErrorCode code, string field, string message, string serviceStackTrace, Exception innerException)
     : base(message, innerException)
 {
     _code              = code;
     _field             = field;
     _serviceStackTrace = serviceStackTrace;
 }
Beispiel #2
0
 public ServiceResult(ServiceErrorCode errorCode)
 {
     Error = new ServiceError
     {
         Code = errorCode
     };
 }
Beispiel #3
0
 private ServiceError(ServiceErrorCode code, string message)
 {
     Contract.Requires(message != null);
     Code          = code;
     Message       = message;
     MessageFields = new Dictionary <string, object>();
 }
 protected static void Require(bool condition, ServiceErrorCode errorCode, Func <object[]>?argsFactory = null)
 {
     if (!condition)
     {
         throw new ServiceErrorException(errorCode, argsFactory?.Invoke());
     }
 }
 public ServerException(ServiceErrorCode code, string field, string message, string serviceStackTrace, Exception innerException)
     : base(message, innerException)
 {
     _code = code;
     _field = field;
     _serviceStackTrace = serviceStackTrace;
 }
        private int ConvertErrorCode(ServiceErrorCode errorCode)
        {
            switch (errorCode)
            {
            case ServiceErrorCode.InvalidItem: return(422);

            case ServiceErrorCode.ItemNotFound: return(404);

            default: return(500);
            }
        }
Beispiel #7
0
 /// <summary>
 /// Является ли ошибка Ошибкой при работе с контактами
 /// </summary>
 /// <param name="error"></param>
 public static bool IsContactError(this ServiceErrorCode error)
 {
     return(error == ServiceErrorCode.ContactListError ||
            error == ServiceErrorCode.ContragentIsNotAuthorized ||
            error == ServiceErrorCode.ContactIsNotAuthorized ||
            error == ServiceErrorCode.ContactIsAlreadyAuthorized ||
            error == ServiceErrorCode.ContactAuthIsAlreadyRequested ||
            error == ServiceErrorCode.ContactHasRejectedAuth ||
            error == ServiceErrorCode.ContactAuthRequestNotFound ||
            error == ServiceErrorCode.OrganizationMustBeActive ||
            error == ServiceErrorCode.ContactAuthIsRejected);
 }
Beispiel #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MSSqlErrorException"/> class.
 /// </summary>
 /// <param name="errorCode">The error code.</param>
 /// <param name="arguments">The arguments.</param>
 public MSSqlErrorException(ServiceErrorCode errorCode, params string[] arguments)
     : base(errorCode, arguments)
 {
 }
 protected static void Require <T>(bool condition, ServiceErrorCode errorCode, Expression <Func <TQuery, T> > memberPathExpression)
 {
     Require(condition, errorCode, () => new[] { memberPathExpression.MemberPath() });
 }
 public ServiceException(ServiceErrorCode serviceErrorCode, string message) : base(message)
 {
     this.serviceErrorCode = serviceErrorCode;
 }
 public ServiceException(ServiceErrorCode serviceErrorCode) : base()
 {
     this.serviceErrorCode = serviceErrorCode;
 }
Beispiel #12
0
 public RegisterServiceEventArgs(IRegisterService service, bool isRegistered, ServiceErrorCode error)
 {
     this.Service      = service;
     this.IsRegistered = isRegistered;
     this.ServiceError = error;
 }
Beispiel #13
0
 public DocumentValidationException(ServiceErrorCode serviceErrorCode)
     : base(serviceErrorCode)
 {
 }
 public DocumentValidationException(ServiceErrorCode serviceErrorCode, string message, Exception innerException)
     : base(serviceErrorCode, message, innerException)
 {
 }
 public ServerException(ServiceErrorCode code)
     : base()
 {
     _code = code;
 }
 protected void AssertErrorCode(ServiceErrorCode code, Error error)
 {
     Assert.Equal(code.ToString(), error.Code);
 }
 public DocumentValidationException(ServiceErrorCode serviceErrorCode)
     : base(serviceErrorCode)
 {
 }
 public ValidationException(ServiceErrorCode serviceErrorCode, string field, string message, Exception innerException)
     : base(serviceErrorCode, message, innerException)
 {
     Field = field;
 }
 public ValidationException(ServiceErrorCode serviceErrorCode, string field)
     : base(serviceErrorCode)
 {
     Field = field;
 }
Beispiel #20
0
 public ServiceError(ServiceErrorCode code)
 {
     Code = code;
 }
Beispiel #21
0
 public void SetError <TProperty>(ServiceErrorCode errorCode, Expression <Func <TModel, TProperty> > memberPathExpression)
 {
     ErrorCode        = errorCode;
     ErrorArgsFactory = () => new[] { GetMemberPath(memberPathExpression) };
 }
Beispiel #22
0
 internal ServiceErrorException(ServiceErrorCode errorCode)
     : this(errorCode, null)
 {
 }
 /// <summary>
 /// Returns true if <paramref name="errorCode"/> is among the errors.
 /// </summary>
 /// <param name="errorCode">The error being looked for.</param>
 /// <returns>True if the error is present.</returns>
 public bool HasErrorCode(ServiceErrorCode errorCode)
 {
     return(Errors.FirstOrDefault(err => err.Code == errorCode) != null);
 }
Beispiel #24
0
 internal ServiceErrorException(ServiceErrorCode errorCode, params object[]?args)
 {
     ErrorCode = errorCode;
     Args      = args ?? Array.Empty <object>();
 }
 public ServiceProtocolException(ServiceErrorCode errorCode, Exception innerException)
     : base(string.Format(c_msg, errorCode, null), innerException)
 {
     ErrorCode = errorCode;
 }
Beispiel #26
0
 public ServiceErrorModel(ServiceErrorCode code, string details)
 {
     Code    = code;
     Details = details;
 }
Beispiel #27
0
 public DocumentValidationException(ServiceErrorCode serviceErrorCode, string message, Exception innerException)
     : base(serviceErrorCode, message, innerException)
 {
 }
 public ServiceProtocolException(ServiceErrorCode errorCode, string message)
     : base(string.Format(c_msg, errorCode, message))
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="FileServiceErrorException"/> class.
 /// </summary>
 /// <param name="errorCode">The error code.</param>
 public FileServiceErrorException(ServiceErrorCode errorCode)
     : base(errorCode)
 {
 }
 public ServiceProtocolException(ServiceErrorCode errorCode, Exception innerException)
     : base(string.Format(c_msg, errorCode, null), innerException)
 {
     ErrorCode = errorCode;
 }
 public ServiceException(ServiceErrorCode serviceErrorCode, string message, Exception innerException) : base(message, innerException)
 {
     this.serviceErrorCode = serviceErrorCode;
 }
 public ValidationException(ServiceErrorCode serviceErrorCode, string field)
     : base(serviceErrorCode)
 {
     Field = field;
 }
Beispiel #33
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MSSqlErrorException"/> class.
 /// </summary>
 /// <param name="errorCode">The error code.</param>
 public MSSqlErrorException(ServiceErrorCode errorCode)
     : base(errorCode)
 {
 }
 public ServiceError(string message, ServiceErrorCode errorCode)
 {
     Message   = message;
     ErrorCode = errorCode;
 }
 public ServiceProtocolException(ServiceErrorCode errorCode, string message)
     : base(string.Format(c_msg, errorCode, message))
 {
 }
Beispiel #36
0
 public ServerException(ServiceErrorCode code)
     : base()
 {
     _code = code;
 }
Beispiel #37
0
 public void SetError(ServiceErrorCode errorCode, Func <object[]>?errorArgsFactory = null)
 {
     ErrorCode        = errorCode;
     ErrorArgsFactory = errorArgsFactory;
 }
Beispiel #38
0
 public ServerException(ServiceErrorCode code, string field, string message)
     : base(message)
 {
     _code  = code;
     _field = field;
 }
 public RegisterServiceEventArgs(IRegisterService service, bool isRegistered, ServiceErrorCode error)
 {
     this.service = service;
     this.is_registered = isRegistered;
     this.error = error;
 }
 public ServerException(ServiceErrorCode code, string field, string message)
     : base(message)
 {
     _code = code;
     _field = field;
 }