Wrap errors when socket is created.