canceling delete of a message throws JS error
Categories
(Thunderbird :: Mail Window Front End, defect)
Tracking
(Not tracked)
People
(Reporter: aceman, Unassigned)
Details
Comment 1•7 years ago
|
||
Comment 2•5 years ago
|
||
It should be due to this: https://searchfox.org/comm-central/rev/87456630f1a92870f0c03a404def84207ef50c95/mailnews/base/src/nsMsgDBView.cpp#3117 - maybe we can just avoid returning error
But I think we want an error, if the messages weren't removed.
The problem is the returned error is very generic and thus we can't catch and hide it.
If we could change it to something like NS_MSG_ERROR_COPY_FOLDER_ABORTED (or define a new proper error), then maybe we could do as in bug 696186, hide the exception from the UI, but keep it for other callers (which would want to know the error (cancelling) happened).
Comment 4•5 years ago
|
||
In general throwing should be avoided when you can. You could just have it return true for went trough with delete, and false for not. But seems like very few callers even care.
It returns a nsresult as is the norm. Which is translated to an exception when called from JS, as usual.
How would you return the true/false? Any sample method that already does that?
Comment 6•5 years ago
|
||
You'd change the IDL https://searchfox.org/comm-central/rev/258c28a105511491efbfc274a392e90d82eeefce/mailnews/db/msgdb/public/nsIMsgDatabase.idl#420 to be
boolean deleteMessages(in Array<nsMsgKey> nsMsgKeys, in nsIDBChangeListener instigator);
Of course in cpp that just translates to setting a boolean out param.
Updated•3 years ago
|
Description
•