areaDetector / ADAravis

areaDetector driver for GenICam cameras using the Aravis library on Linux.
https://areadetector.github.io/master/ADAravis/ADAravis.html
6 stars 8 forks source link

Aravis error propagation #10

Closed mdavidsaver closed 3 years ago

mdavidsaver commented 3 years ago

It would be helpful if aravis library errors could be propagated and printed instead of a unhelpfully generic message like eg. "Making stream failed".

https://github.com/areaDetector/ADAravis/blob/45ec346cb75e13487774f0866b2630bf591a4a99/aravisApp/src/ADAravis.cpp#L435-L439

This would entail passing a GError** as the last argument of arv_camera_create_stream(), and then printing GError::message.

 GError* err = NULL;
 this->stream = arv_camera_create_stream (this->camera, NULL, NULL, &err); 
 if (this->stream == NULL) { 
     asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, 
                 "%s:%s: Making stream failed, retrying in 5s... : %s\n", 
                 driverName, functionName, err->message);
     g_error_free(err); 

GError* need to be freed with g_error_free(). cf. GErrorHelper is a c++ish way to ensure that this is done: https://github.com/mdavidsaver/aravisGigE/blob/d90a9995886b3d7590a17f5ebf4e28886f7ed2dd/aravisGigEApp/src/ghelper.h#L50

 GErrorHelper err;
 this->stream = arv_camera_create_stream (this->camera, NULL, NULL, err.get()); 
 if (this->stream == NULL) { 
     asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR, 
                 "%s:%s: Making stream failed, retrying in 5s... : %s\n", 
                 driverName, functionName, err->message);
MarkRivers commented 3 years ago

Done via 4637163a3cf49008159234212686203c1b666cd1.