[RFC] Wrap errors

Instead of locking the thread, what we can do is wrap each function in
such a way that we can get back an error object without fear that
switching threads once back in Go-land will make us lose the right
one.