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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]