Skip to content

Commit 245d426

Browse files
authored
fix: error messages (#1769)
* fix: error messages * fix: feedback
1 parent ec4a781 commit 245d426

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

game/static/game/css/game.css

+3
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ div > .navigation_button_kurono {
181181
margin:0;
182182
border: none;
183183
resize: none;
184+
height: 100vh;
185+
min-height: 100vh;
186+
max-height: 100vh;
184187
}
185188

186189
#editor {

game/static/game/js/pythonControl.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,22 @@ ocargo.PythonControl = function () {
129129
}
130130

131131
function outf(outputText) {
132+
/** @type {string} */
133+
let text = outputText
134+
135+
if (text.startsWith("ParseError: ")) {
136+
text += "\nThis may be because your code has not been formatted correctly or you have not indented your code correctly."
137+
} else if (text.startsWith("AttributeError: ")) {
138+
text += "\nEnsure that the object has the method or property. Review the PY commands for help.\nYou may also be trying to import something that doesn't exist."
139+
} else if (text.startsWith("NameError: ")) {
140+
text += "\nName errors usually happen because you have misspelt a variable name. Double check your spelling."
141+
} else if (text.startsWith("TypeError: ")) {
142+
text += "\nType errors usually happen because you are trying to perform an illegal action on an object."
143+
}
144+
132145
ocargo.animation.appendAnimation({
133146
type: 'console',
134-
text: outputText
147+
text
135148
});
136149
}
137150

0 commit comments

Comments
 (0)