put getsockopt error in exception