errors handling & client struct