refine error message

This commit is contained in:
Jare Guo
2016-02-23 13:52:12 +08:00
parent d9327b3180
commit 8aea4f8a2e
2 changed files with 13 additions and 5 deletions
+5 -3
View File
@@ -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);
}
+8 -2
View File
@@ -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;
}