diff --git a/blocks_vertical/control.js b/blocks_vertical/control.js index 061af48c2d..8cf9ce0890 100644 --- a/blocks_vertical/control.js +++ b/blocks_vertical/control.js @@ -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.