public static object CreateErrorResponse(string errorCode, string errorMessage, IEnumerable <ValidationErrorField> validationErrors) { var responseStatus = ResponseStatusUtils.CreateResponseStatus(errorCode, errorMessage, validationErrors); var responseDto = CreateResponseDto(null, responseStatus); return(new HttpError(responseDto, HttpStatusCode.BadRequest, errorCode, errorMessage)); }
public ResponseStatus ToResponseStatus() { var errors = Errors.ConvertAll(x => new ValidationErrorField(x.ErrorCode, x.PropertyName, x.ErrorMessage)); var responseStatus = ResponseStatusUtils.CreateResponseStatus(typeof(ValidationException).Name, Message, errors); return(responseStatus); }
public ResponseStatus ToResponseStatus() { var errors = Errors.Map(x => new ValidationErrorField(x.ErrorCode, x.PropertyName, x.ErrorMessage) { Meta = x.CustomState as Dictionary <string, string> ?? x.FormattedMessagePlaceholderValues.ToStringDictionary() }); var responseStatus = ResponseStatusUtils.CreateResponseStatus(typeof(ValidationException).GetOperationName(), Message, errors); return(responseStatus); }
public ResponseStatus ToResponseStatus() { var errors = Errors.Map(x => new ValidationErrorField(x.ErrorCode, x.PropertyName, x.ErrorMessage) { Meta = x.CustomStateAsDictionary() }); var responseStatus = ResponseStatusUtils.CreateResponseStatus(typeof(ValidationException).GetOperationName(), Message, errors); return(responseStatus); }
public ResponseStatus ToResponseStatus() { return(ResponseStatusUtils.CreateResponseStatus(ErrorCode, Message, Violations)); }
public ResponseStatus ToResponseStatus() => ResponseStatusUtils.CreateResponseStatus(ErrorCode, Message, Violations);
public static ResponseStatus CreateResponseStatus(string errorCode, string errorMessage) { return(ResponseStatusUtils.CreateResponseStatus(errorCode, errorMessage, null)); }
public static ResponseStatus CreateResponseStatus(string errorCode) { var errorMessage = errorCode.SplitCamelCase(); return(ResponseStatusUtils.CreateResponseStatus(errorCode, errorMessage, null)); }
public static ResponseStatus ToResponseStatus(this ValidationErrorResult validationResult) { return(validationResult.IsValid ? CreateSuccessResponse(validationResult.SuccessMessage) : ResponseStatusUtils.CreateResponseStatus(validationResult.ErrorCode, validationResult.ErrorMessage, validationResult.Errors)); }
public static ResponseStatus ToResponseStatus(this ValidationError validationException) { return(ResponseStatusUtils.CreateResponseStatus(validationException.ErrorCode, validationException.Message, validationException.Violations)); }