[server] Handle libzdb exception in some functions.