Error Handling

Copper provides the cerrors package that helps add structure and context to your errors.

err := s.rockets.ThrustEngine(ctx, Engine3)
if err != nil {
    return cerrors.New(err, "failed to thrust engine", map[string]interface{}{
        "engine": Engine3,
    })
}

Always wrap your errors with a helpful message and tags before returning them. This will produce much better logs.

Last updated