Callback functions dont log errors?

You must Login before you can answer or comment on any questions.

In my code when I have some error in a callback function nothing is logged to the console? Is that a normal behavior?

— asked 9 months ago by Dirk Roland
3 Comments
  • Missing from your question are a number of important pieces of information. I suggest you take a look at the Using Questions and Answers article, specifically the Q&A Question Checklist. The missing information is critical to reproducing problems in a test environment and often indicates other factors that cause the undesirable outcome you are experiencing.

    — commented 9 months ago by Stephen Feather

  • Thanks Steven.

    So, in a particular case I have the following situation, where the function from test.js calls the function in MyModule.js and nothing is logged where I marked it in the code.

    //test.js
    mymodule.createDocumentation(data, function(callback){
    //do stuff
    });
    //MyModule.js
    exports.createDocumentation= function (data, callback) {    
        Cloud.Objects.create(obj, function (e) {
                 if (e.success) {
        // WHEN ERROR OCCURS HERE, NOTHING IS LOGGED TO THE CONSOLE
                         if (callback){
                            callback(true);
                          } 
                 } 
     
            else {
                alert("error");
                      if (callback){
                            callback(true);
                     } 
            }
        });
    }

    — commented 9 months ago by Dirk Roland

  • Sorry for the name typo... Stephen. "obj" in the above code should be "data"

    — commented 9 months ago by Dirk Roland

1 Answer

in your test.js, write code like this:

//test.js
mymodule.createDocumentation(data, function(){
    callback();
});

Your Answer

Think you can help? Login to answer this question!