All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- RandomSkunk.Results:
- Add
Maybe<T>.ToFailIfNone
method.
- Add
- RandomSkunk.Results:
- Add nullable annotation to the
Error
parameter in implicit operators.
- Add nullable annotation to the
1.2.0 - 2023-04-10
- RandomSkunk.Results:
- Add
Errors.Canceled
and automatic task cancellation handling.
- Add
- RandomSkunk.Results:
- Catch and handle exceptions thrown from callbacks where possible.
1.1.0 - 2023-03-28
-
RandomSkunk.Results:
- Add
Errors.NoValue()
method. - Add implicit conversion from
Result<Unit>
andMaybe<Unit>
toResult
. - Add overloads for
Maybe<T>.ToResult
andMaybe<T>.Truncate
withonNoneSelector
parameter. - Add implicit conversion operator methods from
Error
toResult
,Result<T>
, andMaybe<T>
. - Add
Unit.Invoke
method. - Add
AwaitSettings.ContinueOnCapturedContext
setting.
- Add
-
RandomSkunk.Results.AspNetCore:
- Add
ToFileActionResult
extension methods. - Add
ToActionResult
overloads that have anonSuccess
function parameter. - Add
ToJsonActionResult
extension methods.
- Add
-
RandomSkunk.Results:
- Change targets of LINQ-to-Results methods from
IResult<Unit>
toResult
. This fixes queries where the first clause is of typeTask<Result>
, which would fail to compile. - Add missing calls to
ConfigureAwait(false)
.
- Change targets of LINQ-to-Results methods from
-
RandomSkunk.Results.Http:
- When JSON deserializing, accept
Status
field with token type of eitherNumber
orString
.
- When JSON deserializing, accept
1.0.0 - 2023-01-12
Initial release.
- RandomSkunk.Results:
- Change
Maybe.None()
method to property. - Rename
ErrorCodes.NoneResult
toErrorCodes.NoValue
. - Replace
DBNull
with newUnit
type. - Rename
SetStackTrace
toOmitStackTrace
and flip logic.
- Change
- RandomSkunk.Results:
- Add optional
onNoneSelector
parameter toMaybe<T>.Select
andMaybe<T>.SelectMany
methods. - Add implicit conversion operator methods from
T
toResult<T>
andMaybe<T>
. - Add
AsNonNullable
extension methods.
- Add optional
1.0.0-alpha23 - 2023-01-03
- RandomSkunk.Results.Analyzers:
- Fix generated method when return type is
ValueTask
orValueTask<T>
.
- Fix generated method when return type is
- RandomSkunk.Results:
- Allow Error properties to be initialized with null values. Without this change, there was no way to use a
with
statement to create a new Error with a nullIdentifier
orStackTrace
value. - Adds
isSensitive
andextensions
parameters to resultFail
methods.
- Allow Error properties to be initialized with null values. Without this change, there was no way to use a
1.0.0-alpha22 - 2022-12-09
- RandomSkunk.Results
- Extract more information from an
Exception
when creating anError
from it.
- Extract more information from an
- Add support for .NET 7.
- RandomSkunk.Results
- Add
[TryCatch]
and[assembly: TryCatchThirdParty]
attributes. - Add
ToFailIf
andToNoneIf
methods. - Add
IReadOnlyList<T>.ForEach
extension methods.
- Add
- RandomSkunk.Results.Analyzers (new package)
- Add try/catch source generator.
- Remove support for .NET 5 and .NET Standard 2.1.
1.0.0-alpha21 - 2022-11-10
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Dapper API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Add Truncate methods for
Result<T>
andMaybe<T>
. - Add overloads for
ForEach
methods that take a function with anindex
parameter.
- Add Truncate methods for
- RandomSkunk.Results:
- Added additional optional parameters to methods in the
Errors
class.
- Added additional optional parameters to methods in the
1.0.0-alpha20 - 2022-10-26
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Dapper API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Add [StackTraceBoundary] attribute, which lets an app define a "cutting off" point for a stack trace.
- Add
Error.IsSensitive
property. This property determines whether theError.ToString()
method results in a full representation of the error or an abbreviated representation. - Add
FailResult.SetCallbackFunction
andFailResult.SetReplaceErrorFunction
methods. Functions passed to these methods are invoked whenver aFail
result is created.
- RandomSkunk.Results:
- Remove
IsDefault
property from each result type. - Remove
Error.ToString(bool includeStackTrace)
overload. - Remove
FailResult.OnCreated
property.
- Remove
- RandomSkunk.Results:
- Make stack trace generation consistent.
1.0.0-alpha19 - 2022-10-18
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Dapper API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Add
IEnumerable<T>.ForEach
result extension methods.
- Add
- RandomSkunk.Results:
- Fix doc comment issues by removing all uses of
<inheritdoc cref='...'/>
tags.
- Fix doc comment issues by removing all uses of
1.0.0-alpha18 - 2022-10-13
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Dapper API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Add
GetValueOrDefault()
method toResult<T>
andMaybe<T>
.
- Add
- RandomSkunk.Results:
- Remove "Async" suffix from methods.
- Change value of
ErrorCodes.NoneResult
from -410 to -404.
- RandomSkunk.Results:
- Remove
AndAlso
methods (SelectMany
provides the exact same functionality).
- Remove
- RandomSkunk.Results.Http:
- Fix bug in
ReadMaybeFromJsonAsync<T>
extension method that occurred when the response contained problem problem details with error codeErrorCodes.NoneResult
. Instead of reading it as aNone
result as expected, it would read it as aFail
result.
- Fix bug in
- RandomSkunk.Results.AspNetCore:
- Fix bug in
Maybe<T>.ToActionResult()
extension method that occurred withNone
results. Instead of returning of returning aNotFoundResult
, return anObjectResult
with aProblemDetails
value, where the problem details has anerrorCode
ofErrorCodes.NoneResult
. This makes the HTTP response able to be read correctly with the RandomSkunk.Results.Http package.
- Fix bug in
1.0.0-alpha17 - 2022-10-02
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Dapper API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Add first-class support for
Result
in LINQ-to-Results query syntax. - Add optional
setStackTrace
parameter (default: true) to factory methods inErrors
static class.
- Add first-class support for
- RandomSkunk.Results.Http:
- Add
HttpClient.TryGetByteArrayAsync
extension method.
- Add
- RandomSkunk.Results:
- Remove
Result.AsDBNullResult()
method.
- Remove
1.0.0-alpha16 - 2022-09-22
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Dapper API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Add extension methods for async linq-to-results.
- Add
Unauthorized
andForbidden
properties toErrors
andErrorCodes
classes. - Add
FailResult.OnCreated
callback, which is called whenever a fail result is created. - Add
TryGetError
method for each result type. - Add
TryCatch
overloads with 3, 4, and 5 exceptions.
- RandomSkunk.Results:
- Rename
Map
andFlatMap
methods toSelect
andSelectMany
. - Rename
MapAll
andFlatMapAll
extension methods toSelect
andSelectMany
. - Rename
CompositeError.Create
method toCreateOrGetSingle
. - Replace
GetValue()
andGetError()
extension methods withValue
andError
properties. - Change namespace of enumerable extensions (e.g.
FirstOrNone
orSingleOrFail
) toSystem.Linq
to improve discoverability.
- Rename
- RandomSkunk.Results:
- Remove RandomSkunk.Results.Linq namespace.
- Remove RandomSkunk.Results.Unsafe namespace.
- Remove
Type
property fromResult
,Result<T>
, andMaybe<T>
. - Remove unnecessary generic parameter from some
Flatten
extension methods.
1.0.0-alpha15 - 2022-07-28
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Dapper API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Add
ErrorCodes
class. - Add
Error.ToString(bool includeStackTrace)
overload. - Add
MapAll
andFlatMapAll
extension methods for value tuples of results. - Add
Filter
method and LINQWhere
extension method forResult<T>
. - Add
Result<DBNull> Result.AsDBNullResult()
method. - Add error code description to output of
Error.ToString()
. - Add
ErrorCodes.GetDescription
andRegisterErrorCodes
static methods to get and set the description for an error code respectively.
- Add
- RandomSkunk.Results.Dapper:
- Add
ResultSqlMapper.GridReader
class.
- Add
- RandomSkunk.Results:
- Return a
Fail
result instead of throwing exception when a supplied delegate parameter returns a null value. - Rename
CrossMap
toFlatMap
. - Rename
Error.Type
toError.Title
. - Exclude stack trace from
Error.ToString()
output. - Stack trace generation happens only in the
Error
constructor. - When generating stack trace, exclude frames with methods decorated with the
[StackTraceHidden]
attribute. - In
Error.FromException
, the exception information is completely contained in theInnerError
property. The outer error contains information about the callsite. - Replace delegate extensions with
TryCatch
,TryCatch<TException>
andTryCatch<TException1, TException2>
classes containing methods with the same functionality. - Move extension properties functionality to the base
Error
class. - Improve output of
Error.ToString
.
- Return a
- RandomSkunk.Results.Dapper:
- Catch general
Exception
instead of bothDbException
andException
in allResultSqlMapper
extension methods. TryQueryMultiple
andTryQueryMultipleAsync
return aResultSqlMapper.GridReader
instead of aSqlMapper.GridReader
.
- Catch general
- RandomSkunk.Results.Http:
- Improve the mapping of error code to HTTP status code. The positive or negative hundreds part of the decimal error code becomes the HTTP status code. Examples:
- Error code
9500
maps to HTTP status code500
. - Error code
-4040404
maps to HTTP status code404
.
- Error code
- The mapping of error code to HTTP status code can be specified on a per-call basis.
- Improve the mapping of error code to HTTP status code. The positive or negative hundreds part of the decimal error code becomes the HTTP status code. Examples:
- RandomSkunk.Results:
- Remove
FailFactory<TResult>
class and resultFailWith
fields. - Remove
ResultExtensions.DefaultOnNoneCallback
static property. - Remove most
Func<Error, Error>? onFail
parameters. - Remove
Func<Error>? onNoneGetError
parameters. - Remove
Error.DefaultMessage
static property. - Remove
ExtendedError
class.
- Remove
- RandomSkunk.Results.Http:
- Remove
HttpClientExtensions.DefaultGetHttpError
andHttpClientExtensions.DefaultGetTimeoutError
static properties.
- Remove
- RandomSkunk.Results.Dapper:
- Remove
DbError
class.
- Remove
1.0.0-alpha14 - 2022-06-30
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Dapper API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Add generated stack traces to additional fail factory methods.
- Add
Result.AndAlso
andResult.AndAlsoAsync
extension methods, allowing valueless results to be chained together. - Add
IResult
andIResult<T>
interfaces, allowing different kinds of results to be used the same manner. - Add
OnAllSuccess
,OnAnyNonSuccess
, andMatchAll
extension methods for value tuples of results. - Add
OnNonSuccess
extension methods.
- RandomSkunk.Results.Dapper:
- Add
EnsureOneRowAffected
andEnsureNRowsAffected
extension methods.
- Add
- RandomSkunk.Results:
- Simplify error/fail factory methods that have an exception parameter by removing the
type
andinnerError
parameters and using the name of the exception's type as the error type and its inner exception to create the inner error instead. - Simplify
Result<T>.FromValue
method andFactoryExtensions.ToResult<T>
extension methods by replacingnullValueErrorMessage
,nullValueErrorCode
,nullValueErrorIdentifier
, andnullValueErrorType
parameters with singlegetNullValueError
function parameter. - Rename
Some
toSuccess
.
- Simplify error/fail factory methods that have an exception parameter by removing the
- RandomSkunk.Results:
- Remove the side-effect versions of Match methods. Use the
OnSuccess
,OnFail
, orOnNone
methods to apply side-effects based on a result instead.
- Remove the side-effect versions of Match methods. Use the
1.0.0-alpha13 - 2022-06-03
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Dapper API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Add
AsDisposable()
andAsAsyncDisposable()
extension methods forResult<T>
andMaybe<T>
. - Add additional overloads of
Flatten
where the source is a mixed nested results. For example,Result<Maybe<T>>
flattens toMaybe<T>
. - Add
Result<T>.FromValue
method, which gracefully handles null values by returning aFail
result. - Add extension methods for
IEnumerable<T>
in theRandomSkunk.Results.Linq
namespace that behave the same way that theSystem.Linq
extension methods do. Except instead of returningT
and perhaps throwing an exception or returningnull
, they returnResult<T>
(the "OnFail" methods) orMaybe<T>
(the "OnNone" methods).FirstOrFail
|FirstOrNone
LastOrFail
|LastOrNone
SingleOrFail
|SingleOrNone
ElementAtOrFail
|ElementAtOrNone
- Add
- RandomSkunk.Results:
- Remove
Create
factory field. Pull result factory methods up to the result types themselves. Add backFailWith
factory field that only createsFail
results. - The
FactoryExtensions.ToResult
extension method now gracefully handles null values by callingResult<T>.FromValue
.
- Remove
1.0.0-alpha12 - 2022-05-31
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Dapper API
RandomSkunk.Results.Http API (diff)
- Add RandomSkunk.Results.Dapper project.
- Extension methods mirroring Dapper's extension methods that start with
Try
and return result objects.
- Extension methods mirroring Dapper's extension methods that start with
- RandomSkunk.Results:
- Add
ToResult<T>()
andToMaybe<T>()
extension methods under theRandomSkunk.Results.FactoryExtensions
namespace. - Add
Result<T>.AsMaybe()
andMaybe<T>.AsResult()
methods.
- Add
- RandomSkunk.Results.AspNetCore:
- In
ToActionResult()
extension methods, add ability to provide custom status code for success results.
- In
- RandomSkunk.Results:
- Rename delegate extension methods to differentiate between new factory extension methods.
ToResult()
->TryInvokeAsResult()
ToResult<T>()
->TryInvokeAsResult<T>()
ToMaybe<T>()
->TryInvokeAsMaybe<T>()
- Rename delegate extension methods to differentiate between new factory extension methods.
1.0.0-alpha11 - 2022-05-26
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Fix
Error.ToString()
formatting for derived types.
- Fix
- RandomSkunk.Results:
- Change result extension methods to instance methods wherever possible.
- Move
InvalidStateException
toRandomSkunk.Results.Unsafe
namespace.
- RandomSkunk.Results.Http:
- Add extension methods for
Task<HttpResponseMessage>
andTask<Result<HttpResponseMessage>>
.
- Add extension methods for
- RandomSkunk.Result.AspNetCore:
- Add
ToActionResult
extension methods for results.
- Add
1.0.0-alpha10 - 2022-05-24
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results.Http:
- Fix ambiguous overloads in
HttpResponseMessage
extension methods.
- Fix ambiguous overloads in
- RandomSkunk.Results:
- Add JSON serialization support for
Error
class. - Add
ExtendedError
class, designed to losslessly capture additional properties when deserialized. - Add
OnFail
extension methods for all result types andOnNone
extension methods forMaybe<T>
. - Add overloads of almost all result extension methods that extend a
Task<Result>
,Task<Result<T>>
orTask<Maybe<T>>
. This allows easier method chaining for users.
- Add JSON serialization support for
- RandomSkunk.Results
Error
is now a record class instead of a regular class.
1.0.0-alpha09 - 2022-05-19
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Add
[DebuggerDisplay]
to each of the result structs and the error class. - Add
CrossMap
extension methods to convert from one type of result to another. - Add
ToResult
,ToResult<T>
,ToMaybe<T>
,ToResultAsync
,ToResultAsync<T>
, andToMaybeAsync<T>
extension methods to convert delegates into results. - Add
OnSuccess
andOnSome
extension methods to conditionally invoke a callback and return the same result.
- Add
- RandomSkunk.Results.Http:
- Add extension methods for
HttpClient
to convert HTTP operations into results. - Add
JsonSerializerOptions
parameter toHttpResponseMessage
extension methods.
- Add extension methods for
- RandomSkunk.Results:
- Fix bugs in
Equals(object)
andGetHashCode()
.
- Fix bugs in
- RandomSkunk.Results:
- Add optional
getError
parameter to allMap
andFlapMap
extension methods.
- Add optional
- RandomSkunk.Results.Http:
- Rename
ReadResultFromJsonAsync
extension method toGetResultAsync
.
- Rename
1.0.0-alpha08 - 2022-05-11
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Add
WithError
extension methods.
- Add
- RandomSkunk.Results.AspNetCore:
- Include
Error.InnerError
in the problem details. - Map
Error.Type
toProblemDetails.Title
instead ofProblemDetails.Extensions["errorType"]
.
- Include
- RandomSkunk.Results.Http:
- Set
Error.InnerError
from the problem details. - Map
ProblemDetails.Title
toError.Type
instead of being part ofError.Message
.
- Set
- RandomSkunk.Results.Http:
- Fix bug when getting values of
errorStackTrace
anderrorIdentifier
. Their values would be null even when specified in the JSON.
- Fix bug when getting values of
1.0.0-alpha07 - 2022-05-09
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Add
InnerError
property toError
class. - Add 'type' parameter to
FromException
andFail
factory methods. - Add
Error
property toInvalidStateException
class. - Add
IsDefault
property to result types.
- Add
- RandomSkunk.Results:
- Move
Match
andMatchAsync
methods to result types (from extension methods).
- Move
- RandomSkunk.Results:
- Remove implicit conversion operator from
Maybe<T>
. - Remove unused constructors from
InvalidStateException
class.
- Remove implicit conversion operator from
1.0.0-alpha06 - 2022-05-07
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Replace factory methods on result types with
Create
property of typeIResultFactory
,IResultFactory<T>
, orIMaybeResultFactory<T>
. These interfaces define the same base factory methods that they replace, and extension methods defineFail
overloads. - Rename
MaybeResult
to justMaybe
. Other types are similarly renamed. - Move direct access to the value and error of a result to the
GetValue()
andGetError()
extension methods under theRandomSkunk.Results.Unsafe
namespace.
- Replace factory methods on result types with
- RandomSkunk.Results.AspNetCore:
- Add cancellation token to all async methods.
- Never return a
Fail
result about an issue getting the problem details.
- RandomSkunk.Results:
- Add
InvalidStateException
, which is thrown from the unsafe extension methods when the result an invalid state for directly reading its value or error.
- Add
1.0.0-alpha05 - 2022-05-05
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API (diff)
RandomSkunk.Results.Http API (diff)
- RandomSkunk.Results:
- Add
Type
property to theError
class.- Initialized with the name of the error type (e.g. "Error" for the base
Error
class) by default.
- Initialized with the name of the error type (e.g. "Error" for the base
- Add
- RandomSkunk.Results:
- Each of the result types is a
struct
instead of aclass
. - The
Error
class is no longersealed
. - Changed default value of
Error.DefaultMessage
.
- Each of the result types is a
- RandomSkunk.Results.AspNetCore:
- Each extension method maps the
Type
property to "errorType" extension property ofProblemDetails
object.
- Each extension method maps the
- RandomSkunk.Result.Http:
- Extension method maps the "errorType" extension property of the problem details object to the
Type
of theError
object.
- Extension method maps the "errorType" extension property of the problem details object to the
1.0.0-alpha04 - 2022-05-02
RandomSkunk.Results API (diff)
RandomSkunk.Results.AspNetCore API
RandomSkunk.Results.Http API
- RandomSkunk.Results:
- The
Error
class and the variousFail
factory methods take amessage
parameter instead of amessagePrefix
parameter.
- The
- Add RandomSkunk.Result.Http project.
- Extension methods for getting a result object directly from an
HttpResponseMessage
:HttpResponseMessage.ReadResultFromJsonAsync
HttpResponseMessage.ReadResultFromJsonAsync<T>
HttpResponseMessage.ReadMaybeResultFromJsonAsync<T>
- Extension methods for getting a result object directly from an
- Add RandomSkunk.Result.AspNetCore project.
- Extension method for getting a
ProblemDetails
object from a result error:Error.GetProblemDetails
- Extension method for getting a
- Remove
CallSite
struct. - Remove abstract base classes,
ResultBase
andResultBase<T>
.
Note that version 1.0.0-alpha03 was burned due to publishing error.
1.0.0-alpha02 - 2022-04-28
RandomSkunk.Results API (diff)
- Add result extension methods:
Or
,Else
,Map
,MapAsync
,FlapMap
,FlapMapAsync
,Flatten
,Filter
, andFilterAsync
. - Add
Identifier
property toError
class, - Add overloads of
Fail
result factory methods that take anError
parameter. - Add
FromException
factory method toError
class. - Add overloads of
Fail
result factory methods that take anException
parameter. - Add LINQ extension methods:
Select
,SelectMany
, andWhere
.
1.0.0-alpha01 - 2022-04-28
- Add initial project, solution, and package structures.
- Add
Result
,Result<T>
, andMaybeResult<T>
classes.