You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/10/20 23:02:12 UTC

[GitHub] [cordova-js] Lindsay-Needs-Sleep edited a comment on issue #211: Improve callback error handling

Lindsay-Needs-Sleep edited a comment on issue #211: Improve callback error handling
URL: https://github.com/apache/cordova-js/pull/211#issuecomment-544301775
 
 
   Actually, I think something like this would be the nicest/cleanest option:
   
   ```
    } catch (err) {
       err.cordovaCallbackId = callbackId;
       err.cordovaCallbackSuccess = isSuccess;
       corodva.fireWindowEvent(“cordovacallbackerror”, err);
       throw err;
   }
   ```
   
   Pro’s:
   - This provides the information that was provided in ‘message’ in a much easier to use format.  
   - It does not clobber the err’s message like my last suggestion.  
   - The error is the top level object.
   
   Cons
   - Not backwards compatible for someone was parsing the original ‘message’ string to get the callback Id and callback success state.
   
   Reasons to do this despite the con:
   - Depending on parsing a string like that is bad practice. So likely (hopefully) very few people have done this.
   - cordovacallbackerror is completely undocumented (and untested).  So, this feature is even less likely to have been used/abused.
   - If someone was parsing message, it will be a small change to fix and will result in nicer code.
   
   Thoughts? @erisu @raphinesse 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org