[Kde-pim] MessageQueueJob sends email but returns error

Shaheed Haque srhaque at theiet.org
Sun Mar 11 21:42:12 GMT 2012


That's a good question, made tricky by the lack of any ability
subclass enums. How about something like this:

1. Have the Job base class define an ErrorCodes enum, with a last
extension value set to something like 1000.

typedef enum
{
    OK = 0,
    ...
    EXTENDED_ERROR_START = 1000
} ErrorCodes;

2. Each subclass can define its own enum, starting from EXTENDED_ERROR_START.

3. The base class defines a pure "virtual int errorCode();". In other
words, we use the equivalence of int and enums to smooth over the gap.

I know this is a bit sucky, so I'm not especially hung up on this
being the only possibility...consider it merely a suggestion.

Thanks, Shaheed


2012/3/11 Kevin Krammer <krammer at kde.org>:
> On Saturday, 2012-03-10, David Jarvie wrote:
>
>> 2) A more general problem is that Akonadi jobs don't return useful error
>> codes, only error strings, so it isn't possible for applications to test
>> whether they care about the errors. In this particular case, using
>> sendmail, the fact that an Item hasn't been created in outbox doesn't
>> really matter, but because KAlarm doesn't know which error has occurred,
>> it has to inform the user who will then think that the mail hasn't been
>> sent, when it actually has been. If Akonadi jobs could return unique error
>> codes for each possible error, this would be really useful.
>
> Maybe could accumulate a list of errors somewhere on the wiki and then create
> a header with "topic" namespaces containing error enums.
>
> Or would anyone prefer having all relevant error codes as enums inside the
> respective job's class declaration?
>
> Cheers,
> Kevin
>
> --
> Kevin Krammer, KDE developer, xdg-utils developer
> KDE user support, developer mentoring
>
> _______________________________________________
> KDE PIM mailing list kde-pim at kde.org
> https://mail.kde.org/mailman/listinfo/kde-pim
> KDE PIM home page at http://pim.kde.org/
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list