File tree 2 files changed +21
-2
lines changed
2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -844,6 +844,12 @@ func BenchmarkTryVarCall(b *testing.B) {
844
844
}
845
845
}
846
846
847
+ func BenchmarkTryOut_ErrVarNoRetval (b * testing.B ) {
848
+ for n := 0 ; n < b .N ; n ++ {
849
+ try .Out (noErr ()).Handle ()
850
+ }
851
+ }
852
+
847
853
func BenchmarkTryOut_ErrVar (b * testing.B ) {
848
854
for n := 0 ; n < b .N ; n ++ {
849
855
_ , err := noThrow ()
@@ -863,6 +869,14 @@ func BenchmarkTryOut_StringGenerics(b *testing.B) {
863
869
}
864
870
}
865
871
872
+ func BenchmarkTryOut_StringGenericsNoVal (b * testing.B ) {
873
+ for n := 0 ; n < b .N ; n ++ {
874
+ _ = try .Out1 (noThrow ()).Logf ("test" ).Val1
875
+ r := try .Out1 (noThrow ()).Handle ()
876
+ _ = r .Val1
877
+ }
878
+ }
879
+
866
880
func BenchmarkT_ErrVar (b * testing.B ) {
867
881
for n := 0 ; n < b .N ; n ++ {
868
882
_ , err := noThrow ()
Original file line number Diff line number Diff line change @@ -97,6 +97,11 @@ func (o *Result) Handle(a ...any) *Result {
97
97
if o .Err == nil {
98
98
return o
99
99
}
100
+ o .transportErr (a )
101
+ return o
102
+ }
103
+
104
+ func (o * Result ) transportErr (a []any ) {
100
105
noArguments := len (a ) == 0
101
106
if noArguments {
102
107
panic (o .Err )
@@ -117,11 +122,11 @@ func (o *Result) Handle(a ...any) *Result {
117
122
}
118
123
}
119
124
}
120
- // someone of the handler functions might reset the error value.
125
+
126
+ // some of the handler functions might reset the error value.
121
127
if o .Err != nil {
122
128
panic (o .Err )
123
129
}
124
- return o
125
130
}
126
131
127
132
// Handle allows you to add an error handler to [try.Out] handler chain. Handle
You can’t perform that action at this time.
0 commit comments