@@ -247,6 +247,8 @@ func IsNotEnabled(err error) bool {
247
247
// try.T(f.Close)("annotations")
248
248
func T (err error ) func (fs string , a ... any ) {
249
249
return func (fs string , a ... any ) {
250
+ // NOTE if block cannot be refactored 'because it wouldn't inline
251
+ // then this whole function!
250
252
if err != nil {
251
253
er := fmt .Errorf (fs + handler .WrapError , append (a [1 :], err )... )
252
254
panic (er )
@@ -259,6 +261,8 @@ func T(err error) func(fs string, a ...any) {
259
261
// f := try.T1(os.Open("filename")("cannot open cfg file")
260
262
func T1 [T any ](v T , err error ) func (fs string , a ... any ) T {
261
263
return func (fs string , a ... any ) T {
264
+ // NOTE if block cannot be refactored 'because it wouldn't inline
265
+ // then this whole function!
262
266
if err != nil {
263
267
er := fmt .Errorf (fs + handler .WrapError , append (a [1 :], err )... )
264
268
panic (er )
@@ -270,6 +274,8 @@ func T1[T any](v T, err error) func(fs string, a ...any) T {
270
274
// T2 is similar as [To2] but it let's you to annotate a possible error at place.
271
275
func T2 [T , U any ](v T , u U , err error ) func (fs string , a ... any ) (T , U ) {
272
276
return func (fs string , a ... any ) (T , U ) {
277
+ // NOTE if block cannot be refactored 'because it wouldn't inline
278
+ // then this whole function!
273
279
if err != nil {
274
280
er := fmt .Errorf (fs + handler .WrapError , append (a [1 :], err )... )
275
281
panic (er )
@@ -281,6 +287,8 @@ func T2[T, U any](v T, u U, err error) func(fs string, a ...any) (T, U) {
281
287
// T3 is similar as [To3] but it let's you to annotate a possible error at place.
282
288
func T3 [T , U , V any ](v1 T , v2 U , v3 V , err error ) func (fs string , a ... any ) (T , U , V ) {
283
289
return func (fs string , a ... any ) (T , U , V ) {
290
+ // NOTE if block cannot be refactored 'because it wouldn't inline
291
+ // then this whole function!
284
292
if err != nil {
285
293
er := fmt .Errorf (fs + handler .WrapError , append (a [1 :], err )... )
286
294
panic (er )
0 commit comments