public ServerException(ServiceErrorCode code, string field, string message, string serviceStackTrace, Exception innerException) : base(message, innerException) { _code = code; _field = field; _serviceStackTrace = serviceStackTrace; }
public ServiceResult(ServiceErrorCode errorCode) { Error = new ServiceError { Code = errorCode }; }
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()); } }
private int ConvertErrorCode(ServiceErrorCode errorCode) { switch (errorCode) { case ServiceErrorCode.InvalidItem: return(422); case ServiceErrorCode.ItemNotFound: return(404); default: return(500); } }
/// <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); }
/// <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; }
public RegisterServiceEventArgs(IRegisterService service, bool isRegistered, ServiceErrorCode error) { this.Service = service; this.IsRegistered = isRegistered; this.ServiceError = error; }
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 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; }
public ServiceError(ServiceErrorCode code) { Code = code; }
public void SetError <TProperty>(ServiceErrorCode errorCode, Expression <Func <TModel, TProperty> > memberPathExpression) { ErrorCode = errorCode; ErrorArgsFactory = () => new[] { GetMemberPath(memberPathExpression) }; }
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); }
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; }
public ServiceErrorModel(ServiceErrorCode code, string details) { Code = code; Details = details; }
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 ServiceException(ServiceErrorCode serviceErrorCode, string message, Exception innerException) : base(message, innerException) { this.serviceErrorCode = serviceErrorCode; }
/// <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 void SetError(ServiceErrorCode errorCode, Func <object[]>?errorArgsFactory = null) { ErrorCode = errorCode; ErrorArgsFactory = errorArgsFactory; }
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; }