Throw errors instead of strings. (#1974)

Blocks and generators
This commit is contained in:
Neil Fraser
2018-07-16 16:33:44 -07:00
committed by GitHub
parent 99ebefa1bf
commit c8bfc888c8
23 changed files with 55 additions and 55 deletions

View File

@@ -147,7 +147,7 @@ Blockly.Python['math_single'] = function(block) {
code = 'math.atan(' + arg + ') / math.pi * 180';
break;
default:
throw 'Unknown math operator: ' + operator;
throw Error('Unknown math operator: ' + operator);
}
return [code, Blockly.Python.ORDER_MULTIPLICATIVE];
};
@@ -342,7 +342,7 @@ Blockly.Python['math_on_list'] = function(block) {
code = 'random.choice(' + list + ')';
break;
default:
throw 'Unknown operator: ' + func;
throw Error('Unknown operator: ' + func);
}
return [code, Blockly.Python.ORDER_FUNCTION_CALL];
};