File tree Expand file tree Collapse file tree
ManagedCode.Communication Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313 <PackageLicenseExpression >MIT</PackageLicenseExpression >
1414 <PackageReadmeFile >README.md</PackageReadmeFile >
1515 <Product >Managed Code - Communication</Product >
16- <Version >0.0.7 </Version >
17- <PackageVersion >0.0.7 </PackageVersion >
16+ <Version >0.0.8 </Version >
17+ <PackageVersion >0.0.8 </PackageVersion >
1818 </PropertyGroup >
1919 <PropertyGroup Condition =" '$(GITHUB_ACTIONS)' == 'true'" >
2020 <ContinuousIntegrationBuild >true</ContinuousIntegrationBuild >
Original file line number Diff line number Diff line change @@ -26,24 +26,35 @@ protected Result(bool isSuccess)
2626 Error = null ;
2727 }
2828
29+ protected Result ( Error error )
30+ {
31+ IsSuccess = false ;
32+ Error = error ;
33+ }
34+
2935 public static Result Succeed ( )
3036 {
3137 return new Result ( true ) ;
3238 }
3339
34- public static Result Fail ( Exception error )
40+ public static Result Fail ( )
41+ {
42+ return new Result ( false ) ;
43+ }
44+
45+ public static Result Fail ( Error error )
3546 {
3647 return new Result ( error ) ;
3748 }
3849
39- public static Result Fail ( string errorMessage )
50+ public static Result Fail ( Exception error )
4051 {
41- return new Result ( errorMessage ) ;
52+ return new Result ( error ) ;
4253 }
4354
44- public static Result Fail ( )
55+ public static Result Fail ( string errorMessage )
4556 {
46- return new Result ( false ) ;
57+ return new Result ( errorMessage ) ;
4758 }
4859
4960 public static Result < T > Succeed < T > ( T content )
@@ -56,6 +67,11 @@ public static Result<T> Fail<T>()
5667 return new Result < T > ( false ) ;
5768 }
5869
70+ public static Result < T > Fail < T > ( Error error )
71+ {
72+ return new Result < T > ( error ) ;
73+ }
74+
5975 public static Result < T > Fail < T > ( Exception exception )
6076 {
6177 return new Result < T > ( exception ) ;
Original file line number Diff line number Diff line change @@ -6,20 +6,24 @@ public class Result<T> : Result
66{
77 public T ? Value { get ; }
88
9- public Result ( Exception exception ) : base ( exception )
9+ internal Result ( Exception exception ) : base ( exception )
1010 {
1111 }
1212
13- public Result ( string errorMessage ) : base ( errorMessage )
13+ internal Result ( string errorMessage ) : base ( errorMessage )
1414 {
1515 }
1616
17- public Result ( bool isSuccess , T value ) : base ( isSuccess )
17+ internal Result ( bool isSuccess , T value ) : base ( isSuccess )
1818 {
1919 Value = value ;
2020 }
2121
22- public Result ( bool isSuccess ) : base ( isSuccess )
22+ internal Result ( bool isSuccess ) : base ( isSuccess )
23+ {
24+ }
25+
26+ internal Result ( Error error ) : base ( error )
2327 {
2428 }
2529
@@ -33,6 +37,11 @@ public static Result<T> Succeed(T content)
3337 return new Result < T > ( false ) ;
3438 }
3539
40+ public new static Result < T > Fail ( Error error )
41+ {
42+ return new Result < T > ( error ) ;
43+ }
44+
3645 public new static Result < T > Fail ( Exception exception )
3746 {
3847 return new Result < T > ( exception ) ;
You can’t perform that action at this time.
0 commit comments