-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from amantinband/add-to-error-or-and-update-docs
Add ToErrorOr, Updated Docs & change else to return ErrorOr
- Loading branch information
Showing
15 changed files
with
979 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
namespace ErrorOr; | ||
|
||
public static partial class ErrorOrExtensions | ||
{ | ||
/// <summary> | ||
/// Creates an <see cref="ErrorOr{TValue}"/> instance with the given <paramref name="value"/>. | ||
/// </summary> | ||
public static ErrorOr<TValue> ToErrorOr<TValue>(this TValue value) | ||
{ | ||
return value; | ||
} | ||
|
||
/// <summary> | ||
/// Creates an <see cref="ErrorOr{TValue}"/> instance with the given <paramref name="error"/>. | ||
/// </summary> | ||
public static ErrorOr<TValue> ToErrorOr<TValue>(this Error error) | ||
{ | ||
return error; | ||
} | ||
|
||
/// <summary> | ||
/// Creates an <see cref="ErrorOr{TValue}"/> instance with the given <paramref name="error"/>. | ||
/// </summary> | ||
public static ErrorOr<TValue> ToErrorOr<TValue>(this List<Error> error) | ||
{ | ||
return error; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
namespace ErrorOr; | ||
|
||
/// <summary> | ||
/// Provides factory methods for creating instances of <see cref="ErrorOr{TValue}"/>. | ||
/// </summary> | ||
public static class ErrorOrFactory | ||
{ | ||
/// <summary> | ||
/// Creates a new instance of <see cref="ErrorOr{TValue}"/> with a value. | ||
/// </summary> | ||
/// <typeparam name="TValue">The type of the value.</typeparam> | ||
/// <param name="value">The value to wrap.</param> | ||
/// <returns>An instance of <see cref="ErrorOr{TValue}"/> containing the provided value.</returns> | ||
public static ErrorOr<TValue> From<TValue>(TValue value) | ||
{ | ||
return value; | ||
} | ||
} | ||
namespace ErrorOr; | ||
|
||
/// <summary> | ||
/// Provides factory methods for creating instances of <see cref="ErrorOr{TValue}"/>. | ||
/// </summary> | ||
public static class ErrorOrFactory | ||
{ | ||
/// <summary> | ||
/// Creates a new instance of <see cref="ErrorOr{TValue}"/> with a value. | ||
/// </summary> | ||
/// <typeparam name="TValue">The type of the value.</typeparam> | ||
/// <param name="value">The value to wrap.</param> | ||
/// <returns>An instance of <see cref="ErrorOr{TValue}"/> containing the provided value.</returns> | ||
public static ErrorOr<TValue> From<TValue>(TValue value) | ||
{ | ||
return value; | ||
} | ||
} |
Oops, something went wrong.