I'm working on a web project and I need to serve some files but I want to be able to handle errors in my application in the event that serving the file / content fails. I've written functions to check for most of the common issues that I'm intending to deal with but, to be fully compliant as I hope to make this reusable for others. Therefore, it would be great if there was a way to ensure that lower-level errors weren't just automatically sent to an old http.Error
and not dealt with.
I don't know of a way to deal with those errors unfortunately. I know this is probably by design as it'd be complicated to describe the issue back to the requestor and deal with it in a compliant way but, it just seems a bit too final to just get a http.Error
that can't be dealt with.
Sooo, does anyone know of a way to deal with those cases that I'm not thinking of? Re-writing serveContent
seems entirely unwise (and entirely complicated) so I'm not going down that route. If it isn't possible, then it is what it is I suppose.