From 45ba0e53322d61ad3d1b947198bbd32f36690c4a Mon Sep 17 00:00:00 2001 From: fordsfords Date: Mon, 4 Jul 2016 14:45:41 -0500 Subject: [PATCH] More error checking work --- source/py_gpio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/py_gpio.c b/source/py_gpio.c index 5e90683..2933a83 100644 --- a/source/py_gpio.c +++ b/source/py_gpio.c @@ -170,7 +170,9 @@ static PyObject *py_output_gpio(PyObject *self, PyObject *args) if (!module_setup || dyn_int_array_get(&gpio_direction, gpio, -1) != OUTPUT) { - PyErr_SetString(PyExc_RuntimeError, "The GPIO channel has not been setup() as an OUTPUT"); + char err[2000]; + snprintf(err, sizeof(err), "Channel %s not set up or is not an output", channel); + PyErr_SetString(PyExc_RuntimeError, err); return NULL; }