Re: Cordova bridge call exception console log does not include call stack information

2016-08-31 Thread julio cesar sanchez
As Vladimir Kotikov commented on the issue that we should discuss it on the
mail list we can use this thread to do it.


I'm +1 with it, it sounds useful



2016-08-30 23:33 GMT+02:00 Li, Jonathan :

> Hi,
> The issue is created for the issue at
> https://issues.apache.org/jira/browse/CB-11786
>
> Thanks
> Jonathan
>
> On 8/30/16, 5:20 PM, "julio cesar sanchez"  wrote:
>
> Hi.
>
> Can you create an issue on issues.cordova.io?
>
> El martes, 30 de agosto de 2016, Li, Jonathan 
> escribió:
>
> >
> > Hi,
> > In cordova.js, callbackFromNative method, when handles the
> exception, it
> > only logs the callbackid and error message, but does not log the
> error
> > callstack. Usually the callstack is quite useful to find what causes
> the
> > exception, so just wonder what is the reason to not include it in
> the error
> > console log.
> >
> > If it is fine to include the call stack information in the console
> log, I
> > would like to submit a pull request for the change.
> >
> >
> >   /**
> >  * Called by native code when returning the result from an
> action.
> >  */
> > callbackFromNative: function(callbackId, isSuccess, status, args,
> > keepCallback) {
> > try {
> > var callback = cordova.callbacks[callbackId];
> > if (callback) {
> > if (isSuccess && status ==
> cordova.callbackStatus.OK) {
> > callback.success && callback.success.apply(null,
> args);
> > } else if (!isSuccess) {
> > callback.fail && callback.fail.apply(null, args);
> > }
> > /*
> > else
> > Note, this case is intentionally not caught.
> > this can happen if isSuccess is true, but
> > callbackStatus is NO_RESULT
> > which is used to remove a callback from the list
> > without calling the callbacks
> > typically keepCallback is false in this case
> > */
> > // Clear callback if not expecting any more results
> > if (!keepCallback) {
> > delete cordova.callbacks[callbackId];
> > }
> > }
> > }
> > catch (err) {
> > var msg = "Error in " + (isSuccess ? "Success" :
> "Error") + "
> > callbackId: " + callbackId + " : " + err;
> > console && console.log && console.log(msg);
> > cordova.fireWindowEvent("cordovacallbackerror", {
> 'message':
> > msg });
> > throw err;
> > }
> >
> > Thanks
> > Jonathan
> >
>
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
> For additional commands, e-mail: dev-h...@cordova.apache.org
>


Re: Cordova bridge call exception console log does not include call stack information

2016-08-30 Thread Li, Jonathan
Hi,
The issue is created for the issue at
https://issues.apache.org/jira/browse/CB-11786

Thanks
Jonathan

On 8/30/16, 5:20 PM, "julio cesar sanchez"  wrote:

Hi.

Can you create an issue on issues.cordova.io?

El martes, 30 de agosto de 2016, Li, Jonathan 
escribió:

>
> Hi,
> In cordova.js, callbackFromNative method, when handles the exception, it
> only logs the callbackid and error message, but does not log the error
> callstack. Usually the callstack is quite useful to find what causes the
> exception, so just wonder what is the reason to not include it in the 
error
> console log.
>
> If it is fine to include the call stack information in the console log, I
> would like to submit a pull request for the change.
>
>
>   /**
>  * Called by native code when returning the result from an action.
>  */
> callbackFromNative: function(callbackId, isSuccess, status, args,
> keepCallback) {
> try {
> var callback = cordova.callbacks[callbackId];
> if (callback) {
> if (isSuccess && status == cordova.callbackStatus.OK) {
> callback.success && callback.success.apply(null, 
args);
> } else if (!isSuccess) {
> callback.fail && callback.fail.apply(null, args);
> }
> /*
> else
> Note, this case is intentionally not caught.
> this can happen if isSuccess is true, but
> callbackStatus is NO_RESULT
> which is used to remove a callback from the list
> without calling the callbacks
> typically keepCallback is false in this case
> */
> // Clear callback if not expecting any more results
> if (!keepCallback) {
> delete cordova.callbacks[callbackId];
> }
> }
> }
> catch (err) {
> var msg = "Error in " + (isSuccess ? "Success" : "Error") + "
> callbackId: " + callbackId + " : " + err;
> console && console.log && console.log(msg);
> cordova.fireWindowEvent("cordovacallbackerror", { 'message':
> msg });
> throw err;
> }
>
> Thanks
> Jonathan
>



-
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org


Re: Cordova bridge call exception console log does not include call stack information

2016-08-30 Thread julio cesar sanchez
Hi.

Can you create an issue on issues.cordova.io?

El martes, 30 de agosto de 2016, Li, Jonathan 
escribió:

>
> Hi,
> In cordova.js, callbackFromNative method, when handles the exception, it
> only logs the callbackid and error message, but does not log the error
> callstack. Usually the callstack is quite useful to find what causes the
> exception, so just wonder what is the reason to not include it in the error
> console log.
>
> If it is fine to include the call stack information in the console log, I
> would like to submit a pull request for the change.
>
>
>   /**
>  * Called by native code when returning the result from an action.
>  */
> callbackFromNative: function(callbackId, isSuccess, status, args,
> keepCallback) {
> try {
> var callback = cordova.callbacks[callbackId];
> if (callback) {
> if (isSuccess && status == cordova.callbackStatus.OK) {
> callback.success && callback.success.apply(null, args);
> } else if (!isSuccess) {
> callback.fail && callback.fail.apply(null, args);
> }
> /*
> else
> Note, this case is intentionally not caught.
> this can happen if isSuccess is true, but
> callbackStatus is NO_RESULT
> which is used to remove a callback from the list
> without calling the callbacks
> typically keepCallback is false in this case
> */
> // Clear callback if not expecting any more results
> if (!keepCallback) {
> delete cordova.callbacks[callbackId];
> }
> }
> }
> catch (err) {
> var msg = "Error in " + (isSuccess ? "Success" : "Error") + "
> callbackId: " + callbackId + " : " + err;
> console && console.log && console.log(msg);
> cordova.fireWindowEvent("cordovacallbackerror", { 'message':
> msg });
> throw err;
> }
>
> Thanks
> Jonathan
>


Re: Cordova bridge call exception console log does not include call stack information

2016-08-30 Thread Li, Jonathan

Hi,
In cordova.js, callbackFromNative method, when handles the exception, it only 
logs the callbackid and error message, but does not log the error callstack. 
Usually the callstack is quite useful to find what causes the exception, so 
just wonder what is the reason to not include it in the error console log.

If it is fine to include the call stack information in the console log, I would 
like to submit a pull request for the change.


  /**
 * Called by native code when returning the result from an action.
 */
callbackFromNative: function(callbackId, isSuccess, status, args, 
keepCallback) {
try {
var callback = cordova.callbacks[callbackId];
if (callback) {
if (isSuccess && status == cordova.callbackStatus.OK) {
callback.success && callback.success.apply(null, args);
} else if (!isSuccess) {
callback.fail && callback.fail.apply(null, args);
}
/*
else
Note, this case is intentionally not caught.
this can happen if isSuccess is true, but callbackStatus is 
NO_RESULT
which is used to remove a callback from the list without 
calling the callbacks
typically keepCallback is false in this case
*/
// Clear callback if not expecting any more results
if (!keepCallback) {
delete cordova.callbacks[callbackId];
}
}
}
catch (err) {
var msg = "Error in " + (isSuccess ? "Success" : "Error") + " 
callbackId: " + callbackId + " : " + err;
console && console.log && console.log(msg);
cordova.fireWindowEvent("cordovacallbackerror", { 'message': msg });
throw err;
}

Thanks
Jonathan