Skip to content

Commit

Permalink
Fix missing new on Result.Error (#194)
Browse files Browse the repository at this point in the history
* Add missing new

* Remove unnecessary braces

* Fix comments

* Fix closing tag

* Fix comments

---------

Co-authored-by: Steve Smith <[email protected]>
  • Loading branch information
tpitlik-dev and ardalis committed Sep 11, 2024
1 parent 04758ce commit 0a8ba20
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Ardalis.Result.AspNetCore/ResultStatusMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public ResultStatusMap AddDefaultMap()
/// Allows to override default status code for specific Http Methods
/// </summary>
/// <param name="status">Result Status to map.</param>
/// <param name="defaultStatusCode">Default Status Code.<param>
/// <param name="defaultStatusCode">Default Status Code.</param>
/// <param name="configure">A <see cref="Action"/> to configure Status Codes for specific Http Methods.</param>
public ResultStatusMap For(ResultStatus status, HttpStatusCode defaultStatusCode, Action<ResultStatusOptions> configure)
{
Expand Down
13 changes: 7 additions & 6 deletions src/Ardalis.Result/Result.Void.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public static Result Success()
/// Represents a successful operation without return type
/// </summary>
/// <param name="successMessage">Sets the SuccessMessage property</param>
/// <returns>A Result></returns>
/// <returns>A Result</returns>
public static Result SuccessWithMessage(string successMessage)
{
return new Result() { SuccessMessage = successMessage };
return new Result { SuccessMessage = successMessage };
}

/// <summary>
Expand Down Expand Up @@ -69,8 +69,8 @@ public static Result<T> Success<T>(T value, string successMessage)
/// A single error message may be provided and will be exposed via the Errors property.
/// </summary>
/// <param name="errorMessage"></param>
/// <returns></returns>
public static Result Error(string errorMessage)
/// <returns>A Result</returns>
public new static Result Error(string errorMessage)
{
return new Result(ResultStatus.Error) { Errors = new[] { errorMessage } };
}
Expand Down Expand Up @@ -173,7 +173,7 @@ public static Result Error(string errorMessage)
/// such as an edit conflict between multiple concurrent updates.
/// See also HTTP 409 Conflict: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_client_errors
/// </summary>
/// <returns>A Result<typeparamref name="T"/></returns>
/// <returns>A Result</returns>
public new static Result Conflict()
{
return new Result(ResultStatus.Conflict);
Expand All @@ -186,7 +186,7 @@ public static Result Error(string errorMessage)
/// See also HTTP 409 Conflict: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#4xx_client_errors
/// </summary>
/// <param name="errorMessages">A list of string error messages.</param>
/// <returns>A Result<typeparamref name="T"/></returns>
/// <returns>A Result</returns>
public new static Result Conflict(params string[] errorMessages)
{
return new Result(ResultStatus.Conflict) { Errors = errorMessages };
Expand All @@ -204,6 +204,7 @@ public static Result Error(string errorMessage)
return new Result(ResultStatus.Unavailable) { Errors = errorMessages };
}

/// <summary>
/// Represents a critical error that occurred during the execution of the service.
/// Everything provided by the user was valid, but the service was unable to complete due to an exception.
/// See also HTTP 500 Internal Server Error: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#5xx_server_errors
Expand Down

0 comments on commit 0a8ba20

Please sign in to comment.