golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.58k stars 17.61k forks source link

proposal: x/image/webp: errInvalidFormat should be exported #69908

Open nemith opened 2 days ago

nemith commented 2 days ago

Proposal Details

When an unknown image type gets decoded in the x/image/webp a unexported error is returned . This should probably be exported.

This would allow us to catch it better than doing string parsing to catch the error type.

https://cs.opensource.google/go/x/image/+/refs/tags/v0.21.0:webp/decode.go;l=19

A separate error with the same message is used here as well and should be updated to use the same type. https://cs.opensource.google/go/x/image/+/refs/tags/v0.21.0:webp/decode.go;l=176

ianlancetaylor commented 2 days ago

CC @nigeltao