Skip to content

Commit

Permalink
Use nested class for Failure.Exeption
Browse files Browse the repository at this point in the history
  • Loading branch information
pmosk committed Dec 4, 2023
1 parent 7389583 commit e3b003a
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 66 deletions.
2 changes: 1 addition & 1 deletion src/core-taggeds-failure/Failure/Failure.T/Failure.T.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ public string FailureMessage
=>
failureMessage ?? string.Empty;

public Exception? SourceException { get; init; } = null;
public System.Exception? SourceException { get; init; } = null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public void Deconstruct(out TFailureCode failureCode, out string failureMessage)
failureMessage = FailureMessage;
}

public void Deconstruct(out TFailureCode failureCode, out string failureMessage, out Exception? sourceException)
public void Deconstruct(out TFailureCode failureCode, out string failureMessage, out System.Exception? sourceException)
{
failureCode = FailureCode;
failureMessage = FailureMessage;
Expand Down
8 changes: 0 additions & 8 deletions src/core-taggeds-failure/Failure/Failure.T/T.Exception.As.cs

This file was deleted.

16 changes: 0 additions & 16 deletions src/core-taggeds-failure/Failure/Failure.T/T.Exception.From.cs

This file was deleted.

11 changes: 11 additions & 0 deletions src/core-taggeds-failure/Failure/Failure.T/T.Exception.To.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace System;

partial struct Failure<TFailureCode>
{
public Failure<TFailureCode>.Exception ToException()
=>
new(
failureCode: FailureCode,
message: failureMessage,
innerException: SourceException);
}
14 changes: 14 additions & 0 deletions src/core-taggeds-failure/Failure/Failure.T/T.Exception.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace System;

partial struct Failure<TFailureCode>
{
public sealed class Exception : System.Exception
{
public Exception(TFailureCode failureCode, string? message, System.Exception? innerException)
: base(message, innerException)
=>
FailureCode = failureCode;

public TFailureCode FailureCode { get; }
}
}

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit e3b003a

Please sign in to comment.