Merge pull request #2189 from knoxHuang/master

remove error info from the engine release for fireball/issues/6721
This commit is contained in:
pandamicro
2017-12-21 10:01:13 +08:00
committed by GitHub
32 changed files with 166 additions and 86 deletions
+7 -15
View File
@@ -329,26 +329,18 @@ cc._throw = CC_EDITOR ? Editor.error : function (error) {
}
};
var errorMapUrl = 'https://github.com/cocos-creator/engine/blob/master/EngineErrorMap.md';
function genLogFunc(func, type) {
return function (id) {
'use strict';
var msg = cc._LogInfos.raw(id, type);
if (arguments.length === 1) {
CC_DEBUG ? func(cc._LogInfos[id]) : func(type + ' ' + id + ', please go to ' + errorMapUrl + '#' + id + ' to see details.');
return;
func(msg);
}
if (CC_DEBUG) {
let argsArr = cc.js.shiftArguments.apply(null, arguments);
func.apply(cc, [cc._LogInfos[id]].concat(argsArr));
} else {
var msg = '';
if (arguments.length === 2) {
msg = 'Arguments: ' + arguments[1];
} else if (arguments.length > 2) {
msg = 'Arguments: ' + cc.js.shiftArguments.apply(null, arguments).join(', ');
}
func(type + ' ' + id + ', please go to ' + errorMapUrl + '#' + id + ' to see details. ' + msg);
else if (arguments.length === 2) {
func(CC_DEBUG ? cc.js.formatStr(msg, arguments[1]) : msg + ' Arguments: ' + arguments[1]);
}
else {
func(cc._LogInfos.e(msg, cc.js.shiftArguments.apply(null, arguments)));
}
};
}
+88
View File
@@ -24,6 +24,16 @@ if (CC_DEBUG) {
"1018": "Grid size must be (1,1)", //ActionGrid3D.initWithSize
"1019": "Failed to construct, Sequence construction needs two or more actions", //ActionInterval.sequence
"1020": "Failed to construct, Spawn construction needs two or more actions", //ActionInterval.spawn
"1021": "cc.Speed.initWithAction(): action must be non nil", //cc.Speed.initWithAction
"1022": "cc.Follow.initWithAction(): followedNode must be non nil", //cc.Follow.initWithAction
"1023": "cc.ActionEase.initWithAction(): action must be non nil", //cc.ActionEase.initWithAction
"1024": "Invalid configuration. It must at least have one control point", //cc.CardinalSplineTo.initWithDuration
"1025": "cc.Sequence.initWithTwoActions(): arguments must all be non nil", //cc.Sequence.initWithTwoActions
"1026": "cc.RepeatForever.initWithAction(): action must be non null", //cc.RepeatForever.initWithAction
"1027": "cc.Spawn.initWithTwoActions(): arguments must all be non null", //cc.Spawn.initWithAction
"1028": "cc.ReverseTime.initWithAction(): action must be non null", //cc.ReverseTime.initWithAction
"1029": "cc.ReverseTime.initWithAction(): the action was already passed in.", //cc.ReverseTime.initWithAction
"1030": "cc.Animate.initWithAnimation(): animation must be non-NULL", //cc.Animate.initWithAction
//configuration: 1100
"1100": "Expected 'data' dict, but not found. Config file: %s", //loadConfigFile
"1101": "Please load the resource first : %s", //loadConfigFile_2
@@ -257,6 +267,7 @@ if (CC_DEBUG) {
"3508": "If program goes here, there should be event in dispatch.", //_updateListeners
"3509": "_inDispatch should be 1 here.", //_updateListeners_2
"3510": "%s's scene graph node not contains in the parent's children", //SceneGraphHelper._getChildrenOffset
"3511": "event is undefined",
//Class: 3600
"3600": "cc.Class will automatically call super constructor of %s, you should not call it manually.", //Class.callSuperCtor
"3601": "The editor property 'playOnFocus' should be used with 'executeInEditMode' in class '%s'", //playOnFocus
@@ -346,6 +357,7 @@ if (CC_DEBUG) {
" default: null,\n" +
" type: cc.Texture2D // use 'type:' instead of 'url:'\n" +
"}",
"3658": "browser does not support getters",//defineGetterSetter
//Prefab: 3700
"3700": "internal error: _prefab is undefined", //_doInstantiate
"3701": "Failed to load prefab asset for node '%s'", //syncWithPrefab
@@ -370,6 +382,7 @@ if (CC_DEBUG) {
"3817": "Sorry, the component of '%s' which with an index of %s is corrupted! It has been removed.",
"3818": "Failed to read or parse project.json", //_loadConfig
"3819": "Warning: target element is not a DIV or CANVAS", //_initRenderer
"3820": "The renderer doesn't support the renderMode %s", //_initRenderer
//Animation: 3900
"3900": "Invalid clip to add", //addClip
"3901": "Invalid clip to remove", //removeClip
@@ -383,6 +396,7 @@ if (CC_DEBUG) {
"3909": "[animate] keyFrames must be non-nil", //animate
"3910": "[animate] ratio should >= 0!", //_doAnimate
"3911": "[animate] ratio should in the order of smallest to largest!", //_doAnimate_2
"3912": "already-playing", //playable play
//Label: 4000
"4000": "Sorry, the cc.Font has been modified from Raw Asset to Asset. Please load the font asset before using.", //font
"4001": "_ccsg.Label._initBMFontWithString(): Impossible to create font. Please check file", //_setBMFontFile
@@ -437,6 +451,15 @@ if (CC_DEBUG) {
"4920": "Sorry, you shouldn\'t use id as item identity any more, please use url or uuid instead, the current id is being set as url: (%s)", // load
"4921": "Invalid pipe or invalid index provided!", //pipeline.insertPipe
"4922": "The pipe to be inserted is already in the pipeline!", //pipeline.insertPipe
"4923": "Uuid Loader: Parse asset [ %s ] failed : %s", // uuid-loader
"4924": "JSON Loader: Input item doesn\\'t contain string content",// uuid-loader
"4925": "Uuid Loader: Deserialize asset [ %s ] failed : %s",// uuid-loader
"4926": "Audio Downloader: no web audio context.",// audio-downloader
"4927": "Audio Downloader: audio not supported on this browser!",// audio-downloader
"4928": "Load %s failed!",// downloadScript
"4929": "Load Webp ( %s ) failed",// downloadWebp
"4930": "Load image ( %s ) failed",// downloadImage
"4931": "Download Uuid: can not find type of raw asset[ %s ]: %s",//asset-loader
//CCObject: 5000
"5000": "object already destroyed", //destroy
"5001": "object not yet destroyed", //realDestroyInEditor
@@ -445,6 +468,7 @@ if (CC_DEBUG) {
//CCSys: 5200
"5200": "Warning: localStorage isn't enabled. Please confirm browser cookie or privacy option", //localStorage
"5201": "browser don't support web audio", //audio
"5202": "This feature supports WebGL render mode only.", //_checkWebGLRenderMode
//Deserialize: 5300
"5300": "Type of target to deserialize not matched with data: target is %s, data is %s", //_deserializeObject
"5301": "Can not find script '%s'", //reportMissingClass
@@ -509,6 +533,19 @@ if (CC_DEBUG) {
"6014": "Can't change blending functions when the particle is being batched", //_updateBlendFunc
"6015": "_ccsg.ParticleSystem.setDisplayFrame(): QuadParticle only supports SpriteFrames with no offsets", //setDisplayFrame
"6016": "_ccsg.ParticleSystem._allocMemory(): Memory should not be allocated when not using batchNode", //WebGLRenderCmd._allocMemory
"6017": "Incomplete or corrupt PNG file", //CCPNGReader
"6018": "Invalid filter algorithm: %s",//CCPNGReader
"6019": "Invalid byte order value.", //CCTIFFReader checkLittleEndian
"6020": "You forgot your towel!", //CCTIFFReader hasTowel
"6021": "Unknown Field Tag: %s", //CCTIFFReader hasTowel
"6022": "Too many bits requested", //CCTIFFReader getBits
"6023": "No bits requested", //CCTIFFReader getBits
"6024": "Cannot recover from missing StripByteCounts", //CCTIFFReader parseTIFF
"6025": "Cannot handle sub-byte bits per sample", //CCTIFFReader parseTIFF
"6026": "Cannot handle sub-byte bits per pixel", //CCTIFFReader parseTIFF
"6027": "Palette image missing color map", //CCTIFFReader parseTIFF
"6028": "Unknown Photometric Interpretation: %s", //CCTIFFReader parseTIFF
"6029": "Unkown error", //CCParticleSystem _applyFile
//Compatible: 6100
"6100": "Not supported file types, Please try use the ccs.load", //widgetFromJsonFile
//CCFactory: 6200
@@ -530,6 +567,9 @@ if (CC_DEBUG) {
"6700": "Can't init canvas '%s' because it conflicts with the existing '%s', the scene should only have one active canvas at the same time", //__preload
"6701": "Should not add Canvas to a node which already contains a renderer component (%s).", //__preload_2
"6702": "Should not add Canvas to a node which size is already used by its other component.", //__preload_3
"6703": "Can't initialise DrawingPrimitiveWebGL. context need is WebGLRenderingContext",//DrawingPrimitiveWebGL
"6704": "Polygon's point must greater than 2",//DrawingPrimitiveCanvas drawPoly
"6705": "Argument must be non-nil",//DrawingPrimitiveCanvas drawPoly
//EventTarget: 6800
"6800": "Callback of event must be non-nil", //on
"6801": "The message must be provided", //emit
@@ -571,6 +611,20 @@ if (CC_DEBUG) {
"7219": "cc.TMXMapInfo.parseXMLFile(): Only base64 and/or gzip/zlib maps are supported", //_parseLayer
"7220": "cc.TMXMapInfo.parseXMLFile(): please load the xml resource first: %s", // parseXMLFile
"7221": "cc.TMXMapInfo.parseXMLFile(): Texture '%s' not found.",
"7222": "Parse %s failed.",// tiled-map
"7223": "_ccsg.TMXLayer.setTileGID(): pos should be non-null",//CCTiledLayer setTileGID
"7224": "_ccsg.TMXTiledMap.getLayer(): layerName should be non-null or non-empty string.",//CCSGTMXTiledMap getLayer
"7225": "_ccsg.TMXTiledMap.getObjectGroup(): groupName should be non-null or non-empty string.",//CCSGTMXTiledMap getObjectGroup
"7226": "_ccsg.TMXLayer.getTileAt(): pos should be non-null",//CCSGTMXLayer getTileAt
"7227": "_ccsg.TMXLayer.getTileAt(): invalid position",//CCSGTMXLayer getTileAt
"7228": "_ccsg.TMXLayer.getTileGIDAt(): pos should be non-null",//CCSGTMXLayer getTileGIDAt
"7229": "_ccsg.TMXLayer.getTileGIDAt(): invalid position",//CCSGTMXLayer getTileGIDAt
"7230": "_ccsg.TMXLayer.setTileGID(): pos should be non-null",//CCSGTMXLayer setTileGID
"7231": "_ccsg.TMXLayer.setTileGID(): invalid position",//CCSGTMXLayer setTileGID
"7232": "_ccsg.TMXLayer.getTileFlagsAt(): pos should be non-null",//CCSGTMXLayer getTileFlagsAt
"7233": "_ccsg.TMXLayer.getTileFlagsAt(): invalid position",//CCSGTMXLayer getTileFlagsAt
"7234": "_ccsg.TMXLayer.removeTileAt(): pos should be non-null",//CCSGTMXLayer removeTileAt
"7235": "_ccsg.TMXLayer.removeTileAt(): invalid position",//CCSGTMXLayer removeTileAt
//Wrapper: 7300
"7300": "The new selected must be number", //CheckBox.selected
"7301": "The new bake must be boolean", //layer
@@ -592,6 +646,12 @@ if (CC_DEBUG) {
"7510": "Spine: Animation not found: %s", //addAnimation
//Render: 7600
"7600": "The context of RenderTexture is invalid.", //_renderingToCacheCanvas
"7601": "cc.RenderTexture._initWithWidthAndHeightForWebGL() : only RGB and RGBA formats are valid for a render texture;", //CCRenderTextureWebGLRenderCmd initWithWidthAndHeight
"7602": "Could not attach texture to the framebuffer",//CCRenderTextureWebGLRenderCmd initWithWidthAndHeight
"7603": "clearDepth isn't supported on Cocos2d-Html5",//CCRenderTextureWebGLRenderCmd clearDepth
"7604": "saveToFile isn't supported on Cocos2d-Html5",//CCRenderTexture saveToFile
"7605": "newCCImage isn't supported on Cocos2d-Html5",//CCRenderTexture newCCImage
//VideoPlayer: 7700
"7700": "On the web is always keep the aspect ratio", //setKeepAspectRatioEnabled
"7701": "Can't know status", //isFullScreenEnabled
@@ -612,6 +672,8 @@ if (CC_DEBUG) {
"7905": "cc.math.mat4Assign(): pOut equals pIn", //mat4AssignSIMD
"7906": "cc.mat.Matrix4.assignFrom(): mat4 equals current matrix", //assignFromSIMD
"7907": "cc.math.Matrix4 equals: pMat1 and pMat2 are same object.", //equalsSIMD
"7908": "Invalid matrix mode specified", //glGetMatrix glMatrixMode
"7909": "current quaternion is an invalid value",// quaternion.js normalize
//Reader: 8000
"8000": "Can't handle this field type or size", //TIFF.getFieldValues
"8001": "No bytes requested", //TIFF.getBytes
@@ -624,6 +686,10 @@ if (CC_DEBUG) {
"8103": "cc.GLProgram.link(): Cannot link invalid program", //link
"8104": "cocos2d: ERROR: Failed to link program: %s", //link
"8105": "cocos2d: cc.shaderCache._loadDefaultShader, error shader type", //_loadDefaultShader
"8106": "Please load the resource firset : %s", //CCGLProgram initWithVertexShaderFilename
"8107": "cc.GLProgram.getUniformLocationForName(): uniform name should be non-null", //CCGLProgram getUniformLocationForName
"8108": "cc.GLProgram.getUniformLocationForName(): Invalid operation. Cannot get uniform location when program is not initialized", //CCGLProgram getUniformLocationForName
"8109": "modelView matrix is undefined.", //CCGLProgram _setUniformForMVPMatrixWithMat4
//Physics: 8200
"8200": "Please set node\'s active instead of rigidbody\'s enabled.", //cc.RigidBody.enabled
//Camera: 8300
@@ -633,6 +699,28 @@ if (CC_DEBUG) {
"8400": "Wrong type arguments, 'filePath' must be a String.", // cc.audioEngine.play
};
cc._LogInfos = logs;
var errorMapUrl = 'https://github.com/cocos-creator/engine/blob/master/EngineErrorMap.md';
function raw (id, type) {
return CC_DEBUG ? cc._LogInfos[id] : `${type} ${id}, please go to ${errorMapUrl}#${id} to see details.`;
}
function format (msg, argsArray) {
return CC_DEBUG ? cc.js.formatStr.apply(null, [msg].concat(argsArray)) : msg + ' Arguments: ' + argsArray.join(', ');
}
cc._LogInfos.e = function () {
var msg = raw(arguments[0], 'ERROR');
if (arguments.length === 1) {
return msg;
}
else {
return format(msg, cc.js.shiftArguments.apply(null, arguments));
}
};
cc._LogInfos.raw = raw;
cc._LogInfos.format = format;
}
// module.exports = false;
+2 -2
View File
@@ -300,7 +300,7 @@ cc.Speed = cc.Action.extend({
*/
initWithAction:function (action, speed) {
if(!action)
throw new Error("cc.Speed.initWithAction(): action must be non nil");
throw new Error(cc._LogInfos.e(1021));
this._innerAction = action;
this._speed = speed;
@@ -489,7 +489,7 @@ cc.Follow = cc.Action.extend({
*/
initWithTarget:function (followedNode, rect) {
if(!followedNode)
throw new Error("cc.Follow.initWithAction(): followedNode must be non nil");
throw new Error(cc._LogInfos.e(1022));
var _this = this;
rect = rect || cc.rect(0, 0, 0, 0);
+1 -1
View File
@@ -129,7 +129,7 @@ cc.CardinalSplineTo = cc.ActionInterval.extend({
initWithDuration:function (duration, points, tension) {
if(!points || points.length === 0)
throw new Error("Invalid configuration. It must at least have one control point");
throw new Error(cc._LogInfos.e(1024));
if (cc.ActionInterval.prototype.initWithDuration.call(this, duration)) {
this.setPoints(points);
+1 -1
View File
@@ -51,7 +51,7 @@ cc.ActionEase = cc.ActionInterval.extend({
*/
initWithAction:function (action) {
if(!action)
throw new Error("cc.ActionEase.initWithAction(): action must be non nil");
throw new Error(cc._LogInfos.e(1023));
if (this.initWithDuration(action.getDuration())) {
this._inner = action;
+6 -6
View File
@@ -341,7 +341,7 @@ cc.Sequence = cc.ActionInterval.extend({
*/
initWithTwoActions:function (actionOne, actionTwo) {
if(!actionOne || !actionTwo)
throw new Error("cc.Sequence.initWithTwoActions(): arguments must all be non nil");
throw new Error(cc._LogInfos.e(1025));
var d = actionOne._duration + actionTwo._duration;
this.initWithDuration(d);
@@ -649,7 +649,7 @@ cc.RepeatForever = cc.ActionInterval.extend({
*/
initWithAction:function (action) {
if(!action)
throw new Error("cc.RepeatForever.initWithAction(): action must be non null");
throw new Error(cc._LogInfos.e(1026));
this._innerAction = action;
return true;
@@ -767,7 +767,7 @@ cc.Spawn = cc.ActionInterval.extend({
*/
initWithTwoActions:function (action1, action2) {
if(!action1 || !action2)
throw new Error("cc.Spawn.initWithTwoActions(): arguments must all be non null");
throw new Error(cc._LogInfos.e(1027));
var ret = false;
@@ -2473,9 +2473,9 @@ cc.ReverseTime = cc.ActionInterval.extend({
*/
initWithAction:function (action) {
if(!action)
throw new Error("cc.ReverseTime.initWithAction(): action must be non null");
throw new Error(cc._LogInfos.e(1028));
if(action === this._other)
throw new Error("cc.ReverseTime.initWithAction(): the action was already passed in.");
throw new Error(cc._LogInfos.e(1029));
if (cc.ActionInterval.prototype.initWithDuration.call(this, action._duration)) {
// Don't leak if action is reused
@@ -2580,7 +2580,7 @@ cc.Animate = cc.ActionInterval.extend({
*/
initWithAnimation:function (animation) {
if(!animation)
throw new Error("cc.Animate.initWithAnimation(): animation must be non-NULL");
throw new Error(cc._LogInfos.e(1030));
var singleDuration = animation.getDuration();
if (this.initWithDuration(singleDuration * animation.getLoops())) {
this._nextFrame = 0;
+2 -2
View File
@@ -114,9 +114,9 @@ cc.ActionManager = cc._Class.extend(/** @lends cc.ActionManager# */{
*/
addAction:function (action, target, paused) {
if(!action)
throw new Error("cc.ActionManager.addAction(): action must be non-null");
throw new Error(cc._LogInfos.e(1000));
if(!target)
throw new Error("cc.ActionManager.addAction(): action must be non-null");
throw new Error(cc._LogInfos.e(1000));
//check if the action target already exists
var element = this._hashTargets[target.__instanceId];
+1 -1
View File
@@ -80,7 +80,7 @@ prototype.play = function () {
this.onResume();
}
else {
this.onError('already-playing');
this.onError(cc._LogInfos.e(3912));
}
}
else {
+1 -1
View File
@@ -267,7 +267,7 @@ cc.configuration = /** @lends cc.configuration# */{
if(!this._inited)
this._init();
var dict = cc.loader.getRes(url);
if(!dict) throw new Error("Please load the resource first : " + url);
if(!dict) throw new Error(cc._LogInfos.e(1102, url));
cc.assertID(dict, 1101, url);
var getDatas = dict["data"];
+2 -2
View File
@@ -143,7 +143,7 @@ var DrawingPrimitiveCanvas = cc._Class.extend({
return;
if (vertices.length < 3)
throw new Error("Polygon's point must greater than 2");
throw new Error(cc._LogInfos.e(6704));
var firstPoint = vertices[0], locContext = this._renderContext.getContext();
var locScaleX = cc.view.getScaleX(), locScaleY = cc.view.getScaleY();
@@ -319,7 +319,7 @@ var DrawingPrimitiveCanvas = cc._Class.extend({
destSize.width, destSize.height);
break;
default:
throw new Error("Argument must be non-nil");
throw new Error(cc._LogInfos.e(6705));
break;
}
},
+1 -1
View File
@@ -44,7 +44,7 @@ var DrawingPrimitiveWebGL = cc._Class.extend({
*/
ctor:function (ctx) {
if (cc.sys.platform !== cc.sys.WECHAT_GAME && !ctx instanceof WebGLRenderingContext)
throw new Error("Can't initialise DrawingPrimitiveWebGL. context need is WebGLRenderingContext");
throw new Error(cc._LogInfos.e(6703));
this._renderContext = ctx;
this._colorArray = new Float32Array([1.0, 1.0, 1.0, 1.0]);
+1 -1
View File
@@ -650,7 +650,7 @@ var game = {
if (this._rendererInitialized) return;
if (!cc._supportRender) {
throw new Error("The renderer doesn't support the renderMode " + this.config[this.CONFIG_KEY.renderMode]);
throw new Error(cc._LogInfos.e(3820, this.config[this.CONFIG_KEY.renderMode]));
}
var el = this.config[game.CONFIG_KEY.id],
+1 -1
View File
@@ -1053,7 +1053,7 @@ var eventManager = {
this._updateDirtyFlagForSceneGraph();
this._inDispatch++;
if(!event || !event.getType)
throw new Error("event is undefined");
throw new Error(cc._LogInfos.e(3511));
if (event.getType().startsWith(cc.Event.TOUCH)) {
this._dispatchTouchEvent(event);
this._inDispatch--;
+1 -1
View File
@@ -54,7 +54,7 @@ AssetLoader.prototype.handle = function (item, callback) {
if (isRawAsset) {
var ext = Path.extname(url).toLowerCase();
if (!ext) {
callback(new Error('Download Uuid: can not find type of raw asset[' + uuid + ']: ' + url));
callback(new Error(cc._LogInfos.e(4931, uuid, url)));
return;
}
ext = ext.substr(1);
@@ -73,7 +73,7 @@ function loadDomAudio (item, callback) {
}
function loadWebAudio (item, callback) {
if (!context) callback(new Error('Audio Downloader: no web audio context.'));
if (!context) callback(new Error(cc._LogInfos.e(4926)));
var request = cc.loader.getXMLHttpRequest();
request.open("GET", item.url, true);
@@ -100,7 +100,7 @@ function loadWebAudio (item, callback) {
function downloadAudio (item, callback) {
if (formatSupport.length === 0) {
return new Error('Audio Downloader: audio not supported on this browser!');
return new Error(cc._LogInfos.e(4927));
}
item.content = item.url;
+3 -3
View File
@@ -63,7 +63,7 @@ function downloadScript (item, callback, isAsync) {
s.parentNode.removeChild(s);
s.removeEventListener('load', loadHandler, false);
s.removeEventListener('error', errorHandler, false);
callback(new Error('Load ' + url + ' failed!'), url);
callback(new Error(cc._LogInfos.e(4928, url)));
}
s.addEventListener('load', loadHandler, false);
s.addEventListener('error', errorHandler, false);
@@ -72,7 +72,7 @@ function downloadScript (item, callback, isAsync) {
function downloadWebp (item, callback, isCrossOrigin, img) {
if (!cc.sys.capabilities.webp) {
return new Error('Load Webp ( ' + item.url + ' ) failed');
return new Error(cc._LogInfos.e(4929, item.url));
}
return downloadImage(item, callback, isCrossOrigin, img);
}
@@ -111,7 +111,7 @@ function downloadImage (item, callback, isCrossOrigin, img) {
downloadImage(item, callback, false, img);
}
else {
callback(new Error('Load image (' + url + ') failed'));
callback(new Error(cc._LogInfos.e(4930, url)));
}
}
+3 -3
View File
@@ -207,14 +207,14 @@ function loadUuid (item, callback) {
json = JSON.parse(item.content);
}
catch (e) {
return new Error('Uuid Loader: Parse asset [' + item.id + '] failed : ' + e.stack);
return new Error(cc._LogInfos.e(4923, item.id, e.stack));
}
}
else if (typeof item.content === 'object') {
json = item.content;
}
else {
return new Error('JSON Loader: Input item doesn\'t contain string content');
return new Error(cc._LogInfos.e(4924));
}
var classFinder;
@@ -259,7 +259,7 @@ function loadUuid (item, callback) {
catch (e) {
cc.deserialize.Details.pool.put(tdInfo);
var err = CC_JSB ? (e + '\n' + e.stack) : e.stack;
return new Error('Uuid Loader: Deserialize asset [' + item.id + '] failed : ' + err);
return new Error(cc._LogInfos.e(4925, item.id, err));
}
asset._uuid = item.uuid;
+1 -1
View File
@@ -716,7 +716,7 @@ else {
sys._checkWebGLRenderMode = function () {
if (cc._renderType !== cc.game.RENDER_TYPE_WEBGL)
throw new Error("This feature supports WebGL render mode only.");
throw new Error(cc._LogInfos.e(5202));
};
var _tmpCanvas1 = document.createElement("canvas"),
+1 -1
View File
@@ -174,7 +174,7 @@ cc.defineGetterSetter = function (proto, prop, getter, setter, getterName, sette
setter && (desc.set = setter);
Object.defineProperty(proto, prop, desc);
} else {
throw new Error("browser does not support getters");
throw new Error(cc._LogInfos.e(3658));
}
};
+2 -2
View File
@@ -106,7 +106,7 @@ math.glMatrixMode = function (mode) {
cc.current_stack = math.texture_matrix_stack;
break;
default:
throw new Error("Invalid matrix mode specified"); //TODO: Proper error handling
throw new Error(cc._LogInfos.e(7908)); //TODO: Proper error handling
break;
}
};
@@ -169,7 +169,7 @@ math.glGetMatrix = function (mode, pOut) {
pOut.assignFrom(math.texture_matrix_stack.top);
break;
default:
throw new Error("Invalid matrix mode specified"); //TODO: Proper error handling
throw new Error(cc._LogInfos.e(7908)); //TODO: Proper error handling
break;
}
};
+1 -1
View File
@@ -153,7 +153,7 @@ proto.multiply = function(quaternion) { //cc.kmQuaternionMultiply
proto.normalize = function(){ //=cc.kmQuaternionNormalize
var length = this.length();
if (Math.abs(length) <= cc.math.EPSILON)
throw new Error("current quaternion is an invalid value");
throw new Error(cc._LogInfos.e(7909));
this.scale(1.0 / length);
return this;
};
+2 -2
View File
@@ -161,7 +161,7 @@ var PNGReader = cc._Class.extend({
}
this.pos += 4;
if (this.pos > this.data.length) {
throw new Error("Incomplete or corrupt PNG file");
throw new Error(cc._LogInfos.e(6017));
}
}
},
@@ -262,7 +262,7 @@ var PNGReader = cc._Class.extend({
}
break;
default:
throw new Error("Invalid filter algorithm: " + data[pos - 1]);
throw new Error(cc._LogInfos.e(6018, data[pos - 1]));
}
row++;
}
+1 -1
View File
@@ -914,7 +914,7 @@ var ParticleSystem = cc.Class({
var self = this;
cc.loader.load(file, function (err, content) {
if (err || !content) {
throw err || new Error('Unkown error');
throw err || new Error(cc._LogInfos.e(6029));
}
if (!self.isValid) {
return;
+11 -11
View File
@@ -65,7 +65,7 @@ var tiffReader = /** @lends tiffReader# */{
this.littleEndian = false;
} else {
console.log(BOM);
throw TypeError("Invalid byte order value.");
throw TypeError(cc._LogInfos.e(6019));
}
return this.littleEndian;
@@ -74,7 +74,7 @@ var tiffReader = /** @lends tiffReader# */{
hasTowel: function () {
// Check for towel.
if (this.getUint16(2) !== 42) {
throw RangeError("You forgot your towel!");
throw RangeError(cc._LogInfos.e(6020));
return false;
}
@@ -95,7 +95,7 @@ var tiffReader = /** @lends tiffReader# */{
if (fieldTag in tagNames) {
return tagNames[fieldTag];
} else {
console.log("Unknown Field Tag:", fieldTag);
cc.logID(6021, fieldTag);
return "Tag" + fieldTag;
}
},
@@ -175,7 +175,7 @@ var tiffReader = /** @lends tiffReader# */{
var shiftLeft,rawBits;
if (totalBits <= 0) {
console.log("No bits requested");
cc.logID(6023);
} else if (totalBits <= 8) {
shiftLeft = 24 + bitOffset;
rawBits = this.getUint8(newByteOffset);
@@ -186,7 +186,7 @@ var tiffReader = /** @lends tiffReader# */{
shiftLeft = bitOffset;
rawBits = this.getUint32(newByteOffset);
} else {
console.log( "Too many bits requested" );
cc.logID(6022);
}
return {
@@ -302,7 +302,7 @@ var tiffReader = /** @lends tiffReader# */{
if (numStripOffsetValues === 1) {
var stripByteCountValues = [Math.ceil((imageWidth * imageLength * bitsPerPixel) / 8)];
} else {
throw Error("Cannot recover from missing StripByteCounts");
throw Error(cc._LogInfos.e(6024));
}
}
@@ -332,7 +332,7 @@ var tiffReader = /** @lends tiffReader# */{
byteOffset = sampleInfo.byteOffset - stripOffset;
bitOffset = sampleInfo.bitOffset;
throw RangeError("Cannot handle sub-byte bits per sample");
throw RangeError(cc._LogInfos.e(6025));
}
}
@@ -342,7 +342,7 @@ var tiffReader = /** @lends tiffReader# */{
jIncrement = bytesPerPixel;
} else {
jIncrement = 0;
throw RangeError("Cannot handle sub-byte bits per pixel");
throw RangeError(cc._LogInfos.e(6026));
}
break;
@@ -412,7 +412,7 @@ var tiffReader = /** @lends tiffReader# */{
sample++;
}
} else {
throw RangeError("Cannot handle sub-byte bits per sample");
throw RangeError(cc._LogInfos.e(6025));
}
// Is our pixel complete?
@@ -535,7 +535,7 @@ var tiffReader = /** @lends tiffReader# */{
// RGB Color Palette
case 3:
if (colorMapValues === undefined) {
throw Error("Palette image missing color map");
throw Error(cc._LogInfos.e(6027));
}
var colorMapIndex = pixelSamples[0];
@@ -547,7 +547,7 @@ var tiffReader = /** @lends tiffReader# */{
// Unknown Photometric Interpretation
default:
throw RangeError('Unknown Photometric Interpretation:', photometricInterpretation);
throw RangeError(cc._LogInfos.e(6028, photometricInterpretation));
break;
}
+2 -2
View File
@@ -343,7 +343,7 @@ cc.RenderTexture = _ccsg.Node.extend(/** @lends cc.RenderTexture# */{
* @param {Number} format
*/
saveToFile: function (filePath, format) {
cc.log("saveToFile isn't supported on Cocos2d-Html5");
cc.logID(7604);
},
/**
@@ -351,7 +351,7 @@ cc.RenderTexture = _ccsg.Node.extend(/** @lends cc.RenderTexture# */{
* @return {*}
*/
newCCImage: function (flipImage) {
cc.log("saveToFile isn't supported on cocos2d-html5");
cc.logID(7605);
return null;
},
@@ -95,5 +95,5 @@ proto.clearRect = function(x, y, width, height){
};
proto.clearDepth = function(depthValue){
cc.log("clearDepth isn't supported on Cocos2d-Html5");
cc.logID(7603);
};
@@ -136,7 +136,7 @@ proto.updateClearColor = function(clearColor){ };
proto.initWithWidthAndHeight = function(width, height, format, depthStencilFormat){
var node = this._node;
if(format === cc.Texture2D.PixelFormat.A8)
cc.log( "cc.RenderTexture._initWithWidthAndHeightForWebGL() : only RGB and RGBA formats are valid for a render texture;");
cc.logID(7601);
var gl = cc._renderContext;
this._fullRect = new cc.Rect(0,0, width, height);
@@ -206,7 +206,7 @@ proto.initWithWidthAndHeight = function(width, height, format, depthStencilForma
// check if it worked (probably worth doing :) )
if(gl.checkFramebufferStatus(gl.FRAMEBUFFER) !== gl.FRAMEBUFFER_COMPLETE)
cc.log("Could not attach texture to the framebuffer");
cc.logID(7602);
locTexture.setAliasTexParameters();
+5 -5
View File
@@ -194,9 +194,9 @@ cc.GLProgram = cc._Class.extend(/** @lends cc.GLProgram# */{
*/
initWithVertexShaderFilename: function (vShaderFilename, fShaderFileName) {
var vertexSource = cc.loader.getRes(vShaderFilename);
if (!vertexSource) throw new Error("Please load the resource firset : " + vShaderFilename);
if (!vertexSource) throw new Error(cc._LogInfos.e(8106, vShaderFilename));
var fragmentSource = cc.loader.getRes(fShaderFileName);
if (!fragmentSource) throw new Error("Please load the resource firset : " + fShaderFileName);
if (!fragmentSource) throw new Error(cc._LogInfos.e(8106, fShaderFileName));
return this.initWithVertexShaderByteArray(vertexSource, fragmentSource);
},
@@ -296,9 +296,9 @@ cc.GLProgram = cc._Class.extend(/** @lends cc.GLProgram# */{
*/
getUniformLocationForName: function (name) {
if (!name)
throw new Error("cc.GLProgram.getUniformLocationForName(): uniform name should be non-null");
throw new Error(cc._LogInfos.e(8107));
if (!this._programObj)
throw new Error("cc.GLProgram.getUniformLocationForName(): Invalid operation. Cannot get uniform location when program is not initialized");
throw new Error(cc._LogInfos.e(8108));
var location = this._uniforms[name] || this._glContext.getUniformLocation(this._programObj, name);
return location;
@@ -682,7 +682,7 @@ cc.GLProgram = cc._Class.extend(/** @lends cc.GLProgram# */{
_setUniformForMVPMatrixWithMat4: function(modelViewMatrix){
if(!modelViewMatrix)
throw new Error("modelView matrix is undefined.");
throw new Error(cc._LogInfos.e(8109));
this._glContext.uniformMatrix4fv(this._uniforms[macro.UNIFORM_MVMATRIX], false, modelViewMatrix.mat);
this._glContext.uniformMatrix4fv(this._uniforms[macro.UNIFORM_PMATRIX], false, math.projection_matrix_stack.top.mat);
},
+10 -10
View File
@@ -473,7 +473,7 @@ _ccsg.TMXLayer = _ccsg.Node.extend(/** @lends _ccsg.TMXLayer# */{
*/
getTileAt: function (pos, y) {
if (pos === undefined) {
throw new Error("_ccsg.TMXLayer.getTileAt(): pos should be non-null");
throw new Error(cc._LogInfos.e(7226));
}
var x = pos;
if (y === undefined) {
@@ -481,7 +481,7 @@ _ccsg.TMXLayer = _ccsg.Node.extend(/** @lends _ccsg.TMXLayer# */{
y = pos.y;
}
if (x >= this._layerSize.width || y >= this._layerSize.height || x < 0 || y < 0) {
throw new Error("_ccsg.TMXLayer.getTileAt(): invalid position");
throw new Error(cc._LogInfos.e(7227));
}
if (!this.tiles) {
cc.logID(7204);
@@ -523,7 +523,7 @@ _ccsg.TMXLayer = _ccsg.Node.extend(/** @lends _ccsg.TMXLayer# */{
*/
getTileGIDAt:function (pos, y) {
if (pos === undefined) {
throw new Error("_ccsg.TMXLayer.getTileGIDAt(): pos should be non-null");
throw new Error(cc._LogInfos.e(7228));
}
var x = pos;
if (y === undefined) {
@@ -531,7 +531,7 @@ _ccsg.TMXLayer = _ccsg.Node.extend(/** @lends _ccsg.TMXLayer# */{
y = pos.y;
}
if (x >= this._layerSize.width || y >= this._layerSize.height || x < 0 || y < 0) {
throw new Error("_ccsg.TMXLayer.getTileGIDAt(): invalid position");
throw new Error(cc._LogInfos.e(7229));
}
if (!this.tiles) {
cc.logID(7205);
@@ -558,7 +558,7 @@ _ccsg.TMXLayer = _ccsg.Node.extend(/** @lends _ccsg.TMXLayer# */{
*/
setTileGID: function(gid, posOrX, flagsOrY, flags) {
if (posOrX === undefined) {
throw new Error("_ccsg.TMXLayer.setTileGID(): pos should be non-null");
throw new Error(cc._LogInfos.e(7230));
}
var pos;
if (flags !== undefined || !(posOrX instanceof cc.Vec2)) {
@@ -572,7 +572,7 @@ _ccsg.TMXLayer = _ccsg.Node.extend(/** @lends _ccsg.TMXLayer# */{
pos.x = Math.floor(pos.x);
pos.y = Math.floor(pos.y);
if(pos.x >= this._layerSize.width || pos.y >= this._layerSize.height || pos.x < 0 || pos.y < 0) {
throw new Error("_ccsg.TMXLayer.setTileGID(): invalid position");
throw new Error(cc._LogInfos.e(7231));
}
if (!this.tiles) {
cc.logID(7206);
@@ -638,11 +638,11 @@ _ccsg.TMXLayer = _ccsg.Node.extend(/** @lends _ccsg.TMXLayer# */{
*/
getTileFlagsAt:function (pos, y) {
if(!pos)
throw new Error("_ccsg.TMXLayer.getTileFlagsAt(): pos should be non-null");
throw new Error(cc._LogInfos.e(7232));
if(y !== undefined)
pos = cc.p(pos, y);
if(pos.x >= this._layerSize.width || pos.y >= this._layerSize.height || pos.x < 0 || pos.y < 0)
throw new Error("_ccsg.TMXLayer.getTileFlagsAt(): invalid position");
throw new Error(cc._LogInfos.e(7233));
if(!this.tiles){
cc.logID(7208);
return null;
@@ -664,13 +664,13 @@ _ccsg.TMXLayer = _ccsg.Node.extend(/** @lends _ccsg.TMXLayer# */{
*/
removeTileAt:function (pos, y) {
if (!pos) {
throw new Error("_ccsg.TMXLayer.removeTileAt(): pos should be non-null");
throw new Error(cc._LogInfos.e(7234));
}
if (y !== undefined) {
pos = cc.p(pos, y);
}
if (pos.x >= this._layerSize.width || pos.y >= this._layerSize.height || pos.x < 0 || pos.y < 0) {
throw new Error("_ccsg.TMXLayer.removeTileAt(): invalid position");
throw new Error(cc._LogInfos.e(7235));
}
if (!this.tiles) {
cc.logID(7209);
+2 -2
View File
@@ -307,7 +307,7 @@ _ccsg.TMXTiledMap = _ccsg.Node.extend(/** @lends _ccsg.TMXTiledMap# */{
*/
getLayer:function (layerName) {
if(!layerName || layerName.length === 0)
throw new Error("_ccsg.TMXTiledMap.getLayer(): layerName should be non-null or non-empty string.");
throw new Error(cc._LogInfos.e(7224));
var locChildren = this._children;
for (var i = 0; i < locChildren.length; i++) {
var layer = locChildren[i];
@@ -325,7 +325,7 @@ _ccsg.TMXTiledMap = _ccsg.Node.extend(/** @lends _ccsg.TMXTiledMap# */{
*/
getObjectGroup:function (groupName) {
if(!groupName || groupName.length === 0)
throw new Error("_ccsg.TMXTiledMap.getObjectGroup(): groupName should be non-null or non-empty string.");
throw new Error(cc._LogInfos.e(7225));
var locChildren = this._children;
for (var i = 0; i < locChildren.length; i++) {
var group = locChildren[i];
+1 -1
View File
@@ -201,7 +201,7 @@ var TiledLayer = cc.Class({
setTileGID: function(gid, posOrX, flagsOrY, flags) {
if (this._sgNode) {
if(posOrX === undefined)
throw new Error("_ccsg.TMXLayer.setTileGID(): pos should be non-null");
throw new Error(cc._LogInfos.e(7223));
var pos;
if (flags !== undefined || !(posOrX instanceof cc.Vec2)) {
// four parameters or posOrX is not a Vec2 object
+1 -1
View File
@@ -12,7 +12,7 @@ const TMX_ENCODING = { encoding: 'utf-8' };
function searchDependFiles(tmxFile, tmxFileData, cb) {
var doc = new DOMParser().parseFromString(tmxFileData);
if (!doc) {
return cb(new Error(`Parse ${tmxFile} failed.`));
return cb(new Error(cc._LogInfos.e(7222, tmxFile)));
}
var textures = [];