Example #1
0
        public ApiError(ApiErrorType type, [NotNull] string title, [NotNull] string detailMessage)
        {
            if (string.IsNullOrWhiteSpace(title))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(title));
            }
            if (string.IsNullOrWhiteSpace(detailMessage))
            {
                throw new ArgumentException("Value cannot be null or whitespace.", nameof(detailMessage));
            }
            if (!Enum.IsDefined(typeof(ApiErrorType), type))
            {
                throw new InvalidEnumArgumentException(nameof(type), (int)type, typeof(ApiErrorType));
            }

            Type          = type;
            Title         = title;
            DetailMessage = detailMessage;
        }
Example #2
0
 public static bool ContainsApiError(this Exception exc, ApiErrorType type)
 {
     return(exc.GetAggregatedExceptions().OfType <ApiErrorException>().Any(aee => aee.ApiErrors.Any(apiError => apiError.Type == type)));
 }
 public ApiRelationshipError(ApiErrorType type, string relationshipName,
                             string additionalmessage = null) : base(type, additionalmessage)
 {
     RelationshipName = relationshipName;
 }
 public ApiAttributeError(ApiErrorType type, string attributeName,
                          string additionalmessage = null) : base(type, additionalmessage)
 {
     AttributeName = attributeName;
 }
Example #5
0
 public ApiParameterError(ApiErrorType type, string parameter,
                          string additionalmessage = null) : base(type, additionalmessage)
 {
     Parameter = parameter;
 }
Example #6
0
 public ApiError(ApiErrorType type, string additionalmessage = null)
 {
     Type = type;
     Additionalmessage = additionalmessage;
 }
 public ApiException(string message, Exception innerException, ApiErrorType errorType)
     : base(message, innerException)
 {
     TypeOfError = errorType;
 }
 public ApiException(Exception innerException, ApiErrorType errorType)
     : base(string.Empty, innerException)
 {
     TypeOfError = errorType;
 }
 public ApiException(ApiErrorType errorType)
 {
     TypeOfError = errorType;
 }
 public ApiException(string message, ApiErrorType errorType)
     : base(message)
 {
     TypeOfError = errorType;
 }
Example #11
0
 public void AddError(ApiErrorType type, string additionalmessage = null)
 {
     AddError(new ApiError(type, additionalmessage));
 }
Example #12
0
 public void AddAttributeError(ApiErrorType type, string attributeName,
                               string additionalmessage = null)
 {
     AddError(new ApiAttributeError(type, attributeName, additionalmessage));
 }
Example #13
0
 public void AddRelationError(ApiErrorType type, string relationshipName, string additionalmessage = null)
 {
     AddError(new ApiRelationshipError(type, relationshipName, additionalmessage));
 }
Example #14
0
 public void AddParameterError(ApiErrorType type, string parameter, string additionalmessage = null)
 {
     AddError(new ApiParameterError(type, parameter, additionalmessage));
 }
 public ApiServerException(string message, ApiErrorType typeOfError, string identifier)
     : base(message, typeOfError)
 {
     Identifier = identifier;
 }