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; }
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; }
public ApiParameterError(ApiErrorType type, string parameter, string additionalmessage = null) : base(type, additionalmessage) { Parameter = parameter; }
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; }
public void AddError(ApiErrorType type, string additionalmessage = null) { AddError(new ApiError(type, additionalmessage)); }
public void AddAttributeError(ApiErrorType type, string attributeName, string additionalmessage = null) { AddError(new ApiAttributeError(type, attributeName, additionalmessage)); }
public void AddRelationError(ApiErrorType type, string relationshipName, string additionalmessage = null) { AddError(new ApiRelationshipError(type, relationshipName, additionalmessage)); }
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; }