socket.http uses a function called protect(), which uses
pcall. There is a sample pair in the LuaSocket distribution
that works around this problem by redefining protect(). Take
a look at dispatch.lua and check-links.lua. Not sure how
this would interact with COPAS, but might be worth it a try.
It doesn't look like it will work with COPAS. COPAS receive and send will
yield, if the I/O would block and the yield assumes it's returning values
to the COPAS scheduler. If you wrap a LuaSocket with coxpcall, coxpcall
will probably catch errors, but will also end up getting the yields from
the COPAS functions. At least this is how I see it now, based on my
limited understanding of how the coroutine-based xpcall is supposed to
work.