From b79bd2ac317427908ced4834cc08a1198ce327a1 Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Jan 04 2017 21:00:17 +0000 Subject: python: Use error description in SanlockException When raising SanlockException, if the error code was a posix error, we included the error description from strerror(3), but for sanlock error codes we included a rather unhelpful "Sanlock exception". Now that we have sanlock_strerror() we can use it to include the actual error description: sanlock.SanlockException: (-223, 'Sanlock resource read failure', 'Lease does not exist on storage') Signed-off-by: Nir Soffer --- diff --git a/python/sanlock.c b/python/sanlock.c index f2ad672..0ef1174 100644 --- a/python/sanlock.c +++ b/python/sanlock.c @@ -54,7 +54,7 @@ __set_exception(int en, char *msg) en = -en; err_name = strerror(en); } else { - err_name = "Sanlock exception"; + err_name = sanlock_strerror(en); } exc_tuple = Py_BuildValue("(iss)", en, msg, err_name);