Skip to content

Commit dcad36a

Browse files
committed
Make encoding err more informative
1 parent 9bf4078 commit dcad36a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

components/camera/camera.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func (ni *NamedImage) Bytes(ctx context.Context) ([]byte, error) {
153153

154154
data, err := rimage.EncodeImage(ctx, ni.img, ni.mimeType)
155155
if err != nil {
156-
return nil, fmt.Errorf("could not encode image: %w", err)
156+
return nil, fmt.Errorf("could not encode image with encoding %s: %w", ni.mimeType, err)
157157
}
158158
ni.data = data
159159
return ni.data, nil
@@ -224,7 +224,8 @@ type Camera interface {
224224

225225
// Images is used for getting simultaneous images from different imagers,
226226
// along with associated metadata (just timestamp for now). It's not for getting a time series of images from the same imager.
227-
// The extra parameter can be used to pass additional options to the camera resource.
227+
// The extra parameter can be used to pass additional options to the camera resource. The filterSourceNames parameter can be used to filter
228+
// only the images from the specified source names. When unspecified, all images are returned.
228229
Images(ctx context.Context, filterSourceNames []string, extra map[string]interface{}) ([]NamedImage, resource.ResponseMetadata, error)
229230

230231
// NextPointCloud returns the next immediately available point cloud, not necessarily one
@@ -311,7 +312,7 @@ func GetImageFromGetImages(
311312

312313
imgBytes, err := rimage.EncodeImage(ctx, img, mimeType)
313314
if err != nil {
314-
return nil, ImageMetadata{}, fmt.Errorf("could not encode image: %w", err)
315+
return nil, ImageMetadata{}, fmt.Errorf("could not encode image with encoding %s: %w", mimeType, err)
315316
}
316317
return imgBytes, ImageMetadata{MimeType: mimeType}, nil
317318
}

0 commit comments

Comments
 (0)