File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 11import _ from 'lodash' ;
2+ import minilog from 'minilog' ;
23
34import GeneratedBlocks from './generated.js' ;
45import MathBlocks from './math.js' ;
@@ -495,11 +496,18 @@ export default function (Blockly) {
495496
496497 Blockly . Ruby . blockToCode_ = Blockly . Ruby . blockToCode ;
497498
499+ minilog . enable ( ) ;
500+ const log = minilog ( 'ruby-generator' ) ;
498501 Blockly . Ruby . blockToCode = function ( block ) {
499502 if ( block && ! block . disabled && block . type . match ( / ^ h a r d w a r e _ / ) ) {
500503 this . definitions_ . prepare__init_hardware = 'init_hardware' ;
501504 }
502- return this . blockToCode_ ( block ) ;
505+ try {
506+ return this . blockToCode_ ( block ) ;
507+ } catch ( error ) {
508+ log . error ( `'${ block . type } ' block is not unsupported to generate Ruby code. Please implement it.` ) ;
509+ return null ;
510+ }
503511 } ;
504512
505513 Blockly = GeneratedBlocks ( Blockly ) ;
You can’t perform that action at this time.
0 commit comments