fn: remove error formatting in fireBeforeCall/fireAfterCall (#1317)

fmt.Errorf strips API errors in models, we should propagate
the error directly.
This commit is contained in:
Tolga Ceylan
2018-11-19 12:23:59 -08:00
committed by GitHub
parent ae7683c49e
commit f797cb933f

View File

@@ -342,12 +342,7 @@ func (c *call) Start(ctx context.Context) error {
}
}
err := c.ct.fireBeforeCall(ctx, c.Model())
if err != nil {
return fmt.Errorf("BeforeCall: %v", err)
}
return nil
return c.ct.fireBeforeCall(ctx, c.Model())
}
func (c *call) End(ctx context.Context, errIn error) error {
@@ -378,8 +373,7 @@ func (c *call) End(ctx context.Context, errIn error) error {
c.stderr.Close()
if err := c.ct.fireAfterCall(ctx, c.Model()); err != nil {
return fmt.Errorf("AfterCall: %v", err)
return err
}
return errIn // original error, important for use in sync call returns
}