Skip to content

Commit 14e55fe

Browse files
committed
fix
1 parent 7bc9bd5 commit 14e55fe

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

js/rpg_core/Graphics.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -439,13 +439,8 @@ Graphics.printErrorDetail = function(error) {
439439
var eventInfo = this._formatEventInfo(error);
440440
var eventCommandInfo = this._formatEventCommandInfo(error);
441441
var info = eventCommandInfo ? eventInfo + ", " + eventCommandInfo : eventInfo;
442-
var stack = (error.stack || '')
443-
.replace(/file:.*js\//g, '')
444-
.replace(/http:.*js\//g, '')
445-
.replace(/https:.*js\//g, '')
446-
.replace(/chrome-extension:.*js\//g, '')
447-
.replace(/\n/g, '<br>');
448-
this._makeErrorDetail(info, decodeURIComponent(stack));
442+
var stack = this._formatStackTrace(error);
443+
this._makeErrorDetail(info, stack);
449444
}
450445
};
451446

@@ -967,18 +962,34 @@ Graphics._formatEventCommandInfo = function(error) {
967962
return "◆Plugin Command: " + error.content;
968963
case "script":
969964
return "◆Script: " + error.content;
965+
case "control_variables":
966+
return "◆Control Variables: Script: " + error.content;
970967
case "conditional_branch_script":
971-
return "◆Conditional Branch(Script): " + error.content;
968+
return "◆If: Script: " + error.content;
972969
case "set_route_script":
973-
return "◆Set Movement Route(Script): " + error.content;
970+
return "◆Set Movement Route: ◇Script: " + error.content;
974971
case "auto_route_script":
975-
return "Autonomous Movement Custom Route(Script): " + error.content;
972+
return "Autonomous Movement Custom Route: ◇Script: " + error.content;
976973
case "other":
977974
default:
978975
return "";
979976
}
980977
};
981978

979+
/**
980+
* @static
981+
* @method _formatStackTrace
982+
* @private
983+
*/
984+
Graphics._formatStackTrace = function(error) {
985+
return decodeURIComponent((error.stack || '')
986+
.replace(/file:.*js\//g, '')
987+
.replace(/http:.*js\//g, '')
988+
.replace(/https:.*js\//g, '')
989+
.replace(/chrome-extension:.*js\//g, '')
990+
.replace(/\n/g, '<br>'));
991+
};
992+
982993
/**
983994
* @static
984995
* @method _createCanvas

js/rpg_objects/Game_Interpreter.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,13 @@ Game_Interpreter.prototype.command122 = function() {
702702
value = this.gameDataOperand(this._params[4], this._params[5], this._params[6]);
703703
break;
704704
case 4: // Script
705-
value = eval(this._params[4]);
705+
try {
706+
value = eval(this._params[4]);
707+
} catch (error) {
708+
error.eventCommand = "control_variables";
709+
error.content = this._params[4];
710+
throw error;
711+
}
706712
break;
707713
}
708714
for (var i = this._params[0]; i <= this._params[1]; i++) {
@@ -1757,7 +1763,6 @@ Game_Interpreter.prototype.command354 = function() {
17571763
// Script
17581764
Game_Interpreter.prototype.command355 = function() {
17591765
var startLine = this._index + 1;
1760-
var postfix = this.nextEventCode() === 655 ? "..." : "";
17611766
var script = this.currentCommand().parameters[0] + '\n';
17621767
while (this.nextEventCode() === 655) {
17631768
this._index++;
@@ -1769,7 +1774,7 @@ Game_Interpreter.prototype.command355 = function() {
17691774
} catch (error) {
17701775
error.line = startLine + "-" + endLine;
17711776
error.eventCommand = "script";
1772-
error.content = this._params[0] + postfix;
1777+
error.content = script;
17731778
throw error;
17741779
}
17751780
return true;

plugins/Community_Basic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
* @param showErrorDetail
156156
* @type boolean
157157
* @text エラー詳細表示
158-
* @desc ONにすると、エラー時にどこでエラーが発生したか及びスタックトレースを表示します
158+
* @desc ONにすると、エラー時にエラーを発生させたイベントの情報とスタックトレースを表示します
159159
* @default true
160160
*
161161
* @param enableProgressBar

0 commit comments

Comments
 (0)