# Cdb apis return always...-1 irrespective of errors

**URL:** <https://dmap-community.ductus.global/t/cdb-apis-return-always-1-irrespective-of-errors/1260>\
**Category:** CDB and CDB API\
**Created:** [May 25, 2017, 5:13am UTC](https://dmap-community.ductus.global/t/cdb-apis-return-always-1-irrespective-of-errors/1260 "2017-05-25T05:13:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sudhanshu](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@sudhanshu](https://dmap-community.ductus.global/u/sudhanshu)\
**Post date:** [May 25, 2017, 5:13am UTC](https://dmap-community.ductus.global/t/cdb-apis-return-always-1-irrespective-of-errors/1260/1 "2017-05-25T05:13:17Z")

</div>

cdb apis return always…-1 irrespective of errors as mentioned in user guide it should return specific error like  
CONFD\_ERR\_MALLOC, CONFD\_ERR\_OS, CONFD\_ERR\_NOSESSION,  
CONFD\_ERR\_BADPATH, CONFD\_ERR\_NOEXISTS, CONFD\_ERR\_ACCESS\_DENIED

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [May 25, 2017, 7:13am UTC](https://dmap-community.ductus.global/t/cdb-apis-return-always-1-irrespective-of-errors/1260/2 "2017-05-25T07:13:56Z")

</div>

You need a little bit more effort to get the error that is set to confd\_errno.

Example:

```
if (cdb_start_session(rsock, CDB_RUNNING) != CONFD_OK) {
        printf ("error: %s (%d): %s\n", confd_strerror(confd_errno), confd_errno, confd_lasterr());
}

```

See confd\_lib\_lib(3) man page section ERRORS.

> Whenever CONFD\_ERR is returned from any API function in libconfd it is possible to obtain additional information on the error through the symbol confd\_errno. Additionally there may be an error text associated with the error. A call to the function  
> char \*confd\_lasterr(void);  
> returns a string which contains additional textual information on the error. Furthermore, the function  
> char \*confd\_strerror(int code);  
> returns a string which describes a particular error code. When one of the The following error codes are available:
