Python 3: raise RuntimeErrors, not generic exceptions
authorNils Philippsen <nils@tiptoe.de>
Wed, 25 Nov 2015 23:57:19 +0000 (00:57 +0100)
committerNils Philippsen <nils@tiptoe.de>
Thu, 26 Nov 2015 13:48:06 +0000 (14:48 +0100)
python/ext/aubiowraphell.h
python/ext/py-sink.c
python/ext/py-source.c

index b9146ef..c75567d 100644 (file)
@@ -13,7 +13,7 @@ Py_ ## NAME ## _init (Py_ ## NAME * self, PyObject * args, PyObject * kwds) \
 { \
   self->o = new_aubio_## NAME ( PARAMS ); \
   if (self->o == NULL) { \
-    PyErr_SetString (PyExc_StandardError, "error creating object"); \
+    PyErr_SetString (PyExc_RuntimeError, "error creating object"); \
     return -1; \
   } \
 \
index be5de36..51b9bc3 100644 (file)
@@ -115,7 +115,7 @@ Py_sink_init (Py_sink * self, PyObject * args, PyObject * kwds)
     aubio_sink_preset_samplerate ( self->o, self->samplerate );
   }
   if (self->o == NULL) {
-    PyErr_SetString (PyExc_StandardError, "error creating sink with this uri");
+    PyErr_SetString (PyExc_RuntimeError, "error creating sink with this uri");
     return -1;
   }
   self->samplerate = aubio_sink_get_samplerate ( self->o );
index f9f972f..085b9ea 100644 (file)
@@ -137,7 +137,7 @@ Py_source_init (Py_source * self, PyObject * args, PyObject * kwds)
   if (self->o == NULL) {
     char_t errstr[30 + strlen(self->uri)];
     sprintf(errstr, "error creating source with %s", self->uri);
-    PyErr_SetString (PyExc_StandardError, errstr);
+    PyErr_SetString (PyExc_RuntimeError, errstr);
     return -1;
   }
   self->samplerate = aubio_source_get_samplerate ( self->o );