tfgo icon indicating copy to clipboard operation
tfgo copied to clipboard

Panic vs Error

Open alimoeeny opened this issue 2 years ago • 2 comments

Hi @galeone :) And as always, thank you for the hard work and for keeping the lights on.

I was wondering if you think it is possible to reduce the number of panic calls in this repository? Would it be okay if I send you PRs that would remove the calls to panic and instead return an error? If you think that is a reasonable thing to do, I assume we might need a separate develop branch for a while since these will be breaking changes (I mean backward incompatible) due to the changes in the signature of these functions?

One example is https://github.com/galeone/tfgo/blob/d89a5c7e31e1d876a46136e30e7891dbc4272b69/image/image.go#L74 where image.Read can return an error if the file extension is not recognized, rather than calling panic

alimoeeny avatar Oct 28 '22 11:10 alimoeeny