Skip to content

Commit

Permalink
try catch blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyGamer13 committed Apr 14, 2024
1 parent f04134b commit 28f3df4
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions blocks_vertical/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,69 @@ Blockly.Blocks['control_if_else'] = {
}
};


Blockly.Blocks['control_try_catch'] = {
/**
* Block for try-catch.
* @this Blockly.Block
*/
init: function () {
this.jsonInit({
"type": "control_try_catch",
"message0": "try to do",
"message1": "%1",
"message2": "if a block errors",
"message3": "%1",
"args1": [
{
"type": "input_statement",
"check": 'normal',
"name": "SUBSTACK"
}
],
"args3": [
{
"type": "input_statement",
"check": 'normal',
"name": "SUBSTACK2"
}
],
"category": Blockly.Categories.control,
"extensions": ["colours_control", "shape_statement"]
});
}
};

Blockly.Blocks['control_throw_error'] = {
init: function () {
this.jsonInit({
"message0": 'throw error %1',
"args0": [
{
"type": "input_value",
"name": "ERROR"
}
],
"category": Blockly.Categories.control,
"extensions": ["colours_control", "shape_end"]
});
}
};

Blockly.Blocks['control_error'] = {
/**
* pm: Block to get a try catch error.
* @this Blockly.Block
*/
init: function () {
this.jsonInit({
"message0": "error",
"category": Blockly.Categories.control,
"extensions": ["colours_control", "output_string"]
});
}
};

Blockly.Blocks['control_stop'] = {
/**
* Block for stop all scripts.
Expand Down

0 comments on commit 28f3df4

Please sign in to comment.