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 22:10:52 UTC

[GitHub] [cordova-js] Lindsay-Needs-Sleep commented on a change in pull request #211: Improve callback error handling

Lindsay-Needs-Sleep commented on a change in pull request #211: Improve callback error handling
URL: https://github.com/apache/cordova-js/pull/211#discussion_r336766905
 
 

 ##########
 File path: src/cordova.js
 ##########
 @@ -226,9 +226,7 @@ var cordova = {
             }
         } catch (err) {
             var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err;
-            console && console.log && console.log(msg);
-            console && console.log && err.stack && console.log(err.stack);
-            cordova.fireWindowEvent('cordovacallbackerror', { 'message': msg });
+            cordova.fireWindowEvent('cordovacallbackerror', { 'message': msg, 'original': err });
 
 Review comment:
   Good point.
   
   This got me thinking.  What do you think of this instead?
   ```
   err.message = msg;
   corodva.fireWindowEvent(“cordovacallbackerror”, err);
   ```
   
   This maintains backwards compatibility, but makes the error the top-level response.  
   
   I think this makes a lot more sense because most people will probably think the object they receive in cordovacallbackerror will be an error.  (At least that is what I originally thought.)

----------------------------------------------------------------
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