You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Vladimir Kotikov (JIRA)" <ji...@apache.org> on 2016/08/31 10:29:20 UTC

[jira] [Commented] (CB-11786) Callstack is not logged in js console log when exception happens in bridge call

    [ https://issues.apache.org/jira/browse/CB-11786?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15451848#comment-15451848 ] 

Vladimir Kotikov commented on CB-11786:
---------------------------------------

[~jonathanli], thank you for creating an issue, but I'm afraid JIRA is not the best place for discussions. The better place would be dev mailing list at dev@cordova.apache.org or Cordova Slack at [cordova.slack.com|cordova.slack.com].

> Callstack is not logged in js console log when exception happens in bridge call  
> ---------------------------------------------------------------------------------
>
>                 Key: CB-11786
>                 URL: https://issues.apache.org/jira/browse/CB-11786
>             Project: Apache Cordova
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: CordovaJS
>    Affects Versions: 6.1.1
>         Environment: all platform
>            Reporter: Jonathan Li
>              Labels: question, triaged
>
> 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.
> {code:javascript}
>    /**
>       * 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;
>          }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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