zhengzkkai / opkg

Automatically exported from code.google.com/p/opkg
0 stars 0 forks source link

libopkg needs a better error reporting mechanism #63

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Users of libopkg have no reasonable way of determining the error from opkg. I 
don't like the idea of having a list of return codes with various meanings (a 
la errno), as this makes it difficult to give accurate information about 
specific errors. A function returning the last known error would be a good 
option (e.g. sqlite's sqlite3_errmsg()).

Original issue reported on code.google.com by graham.g...@gmail.com on 21 Sep 2010 at 7:33

GoogleCodeExporter commented 9 years ago
Here's a start - patch to send "Collected errors:" reports to stderr.

Otherwise it's hard to deal with non-fatal errors (should they be warnings?) in 
scripts.

denix

Original comment by den...@gmail.com on 2 Aug 2011 at 12:06

Attachments:

GoogleCodeExporter commented 9 years ago
The patch looks good, errors should definitely be printed to stderr not stdout. 
I'll try to get it applied for version 0.3.

Also, I disagree with Graham here. Error codes are better because they're 
simpler to handle in code that wants to know what error occurred (use "==" 
rather than "strcmp"). It also means a function opkg_strerror(int err) can 
eventually give the error in a local language, knowing that no sane code is 
going to run strcmp on it.

Maybe we need an error structure that can say what package or file caused the 
error code, something like:

    struct opkg_error {
        int     err;
        char *  cause;
    };

Original comment by paul.betafive on 18 Sep 2013 at 1:47

GoogleCodeExporter commented 9 years ago
Drop back to v0.4.

Original comment by paul.betafive on 1 Feb 2014 at 2:22