Quantcast
Channel: Cocos Forums - Latest topics
Viewing all articles
Browse latest Browse all 17071

Inside a callback from onLoad, there is no error log

$
0
0

@Howrad wrote:

Try the following code:

onLoad: function ()
{
    cc.loader.loadRes("datafile", function(error, data) {
        console.log("before");
        undefinedVariable.property;
        console.log("after");
    });
},

If assets/resources/datafile.json does not exist (that is, it's a loading failure), the console output, either in the browser or the simulator, will be:

before
ReferenceError: undefinedVariable is not defined

If assets/resources/datafile.json exists, the console output, either in the browser or the simulator, will be:

before

So if it loads the file, Cocos will suppress all errors inside that completeCallback, failing silently.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 17071

Trending Articles