From 8aea4f8a2e4b9658dced1db75095ea7fd84f6c91 Mon Sep 17 00:00:00 2001 From: Jare Guo Date: Tue, 23 Feb 2016 13:52:12 +0800 Subject: [PATCH] refine error message --- cocos2d/core/CCNode.js | 8 +++++--- cocos2d/core/platform/deserialize.js | 10 ++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index ede5c20eb5..bcb6508a9d 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -697,9 +697,11 @@ var Node = cc.Class({ var originCount = this._components.length; for (var c = 0; c < originCount; ++c) { var component = this._components[c]; - if (! (component instanceof cc.Component) && CC_EDITOR) { - cc.error('Sorry, the component of "%s" which with an index of %s is corrupted! It has been removed.\nSee DevTools for details.', this.name, c); - console.log('Corrupted component value:', component); + if ( !(component instanceof cc.Component) ) { + if (CC_EDITOR) { + cc.error('Sorry, the component of "%s" which with an index of %s is corrupted! It has been removed.', this.name, c); + console.log('Corrupted component value:', component); + } if (component) { this._removeComponent(component); } diff --git a/cocos2d/core/platform/deserialize.js b/cocos2d/core/platform/deserialize.js index 12c98870fd..31fc98e91e 100644 --- a/cocos2d/core/platform/deserialize.js +++ b/cocos2d/core/platform/deserialize.js @@ -404,9 +404,15 @@ var _Deserializer = (function () { // Type Object (including CCClass) - klass = self._classFinder(serialized.__type__); + var type = serialized.__type__; + klass = self._classFinder(type); if (!klass) { - cc.error('[cc.deserialize] unknown type: ' + serialized.__type__); + if (CC_EDITOR && Editor.UuidUtils.isUuid(type)) { + type = Editor.UuidUtils.decompressUuid(type); + cc.warn('Can not find script "%s"', type); + return null; + } + cc.warn('Can not find class "%s"', type); return null; }