Whenever my operation callback called CONFD_ERRCODE_APPLICATION is set

Hi All!

I have registered operational callbacks for getnext/object/elem… Whenever I get the callback with transaction context I see its set with above error code. Please let me know if I am missing something…

CONFD_ERRCODE_APPLICATION

rgds
Balaji

Old value = 0
New value = 4
0x00000000024c71a6 in clear_error ()
(gdb) bt
#0 0x00000000024c71a6 in clear_error ()
#1 0x00000000024d911b in confd_fd_ready ()

I see above callback before calling my base function which is setting error to the transacation…

rgds
Balaji

Is your code looking at this element?

struct confd_error error;    /* user settable via */
                             /* confd_trans_seterr*() */

Why? (It should perhaps have been in the “ConfD internal fields” section.) As the comment says, it will be set if your callback calls confd_trans_seterr() - and then it will be used, i.e. passed to ConfD, when/if your callback returns CONFD_ERR. If your callback returns CONFD_ERR without calling confd_trans_seterr() or related functions, the pre-set information will be used. And if you read the section “EXTENDED ERROR REPORTING” in the confd_lib_lib(3) man page, you will find:

   A call of confd_trans_seterr(tctx, "string") is equivalent to
   confd_trans_seterr_extended(tctx, CONFD_ERRCODE_APPLICATION, 0, 0,
   "string").

from which yo can perphaps deduce that returning CONFD_ERR without calling any of the confd_trans_seterr*() functions is equivalent to having called

confd_trans_seterr_extended(tctx, CONFD_ERRCODE_APPLICATION, 0, 0, "")

which is what the pre-set info corresponds to. Bottom line, your code should not look at this info at all (nor write it other than via the documented functions).

I have checked on the same lines, but I am not sending any error. When I get my callback called from confd itself I am getting error code preset…

#5 0x0000000001e32e15 in myGetNext (tctx=0xb140e00, kp=0x7ffefd7b03a0, next=-1)
#6 0x00000000024d49a6 in data_callback ()
#7 0x00000000024d8d66 in confd_fd_ready ()

In above case I am getting call from confd_fd_ready and this tctx is already set with error code…

rgds
Balaji

Yes, please read again what I wrote. In particular the “Bottom line” part.

Thanks I do see the same, you are saying don’t depend on the same. But just curious to know why its set. Anyways we will go for now ignoring the same…

rgds
Balaji

As I wrote: “If your callback returns CONFD_ERR without calling confd_trans_seterr() or related functions, the pre-set information will be used.”

Hmm that I got, but my question is when my registered callback is invoked with tctx why the error code is set already ?. I am yet to process any information.

rgds
Balaji

Hence precisely I have not returned error or did any set error. But the transaction I get is already set with this error code…

rgds
Balaji

I’m sorry, I really don’t know what more to say since you don’t seem to understand what I’m saying. Can you please just ignore it? There is no reason whatsoever for your code to examine that data at all, there is no documentation that suggests otherwise, and the library code is working exactly as designed.