@@ -124,8 +124,8 @@ export default () => {
124124 const [ HEIGHT , WIDTH ] = [ DATA . size . Height , DATA . size . Width ] ;
125125 PUZ_BOARD_BONE = new Array ( HEIGHT ) . fill ( ) . map ( _ => Array ( WIDTH ) ) ;
126126 MAIN_BOARD . innerHTML = null ;
127- if ( HEIGHT <= 0 ) { console . error ( `GUARD! Height : ${ HEIGHT } isn't positive` ) ; return endscene ( ) ; }
128- if ( WIDTH <= 0 ) { console . error ( `GUARD! Height : ${ WIDTH } isn't positive` ) ; return endscene ( ) ; }
127+ if ( HEIGHT <= 0 ) { endscene ( ) ; throw RangeError ( `GUARD! Height : ${ HEIGHT } isn't positive` ) ; }
128+ if ( WIDTH <= 0 ) { endscene ( ) ; throw RangeError ( `GUARD! Height : ${ WIDTH } isn't positive` ) ; }
129129 for ( let i = 0 ; i < HEIGHT ; i ++ ) {
130130 const TR = document . createElement ( "tr" ) ;
131131 TR . classList . add ( "puz_board_tr" ) ;
@@ -148,17 +148,16 @@ export default () => {
148148 adj_list = chain_yx = [ ] ;
149149 update_display ( ) ;
150150 }
151- /**todo : DATALINK先が存在しないときの処理*/
152151 const startgame = ( ) => {
153152 const StageID = document . getElementById ( 'StageLink' ) . value ;
154153 if ( isNaN ( StageID ) ) {
155- console . error ( `GUARD! StageID ${ StageID } is NaN` )
156- return endscene ( ) ;
154+ endscene ( ) ;
155+ throw TypeError ( `GUARD! StageID ${ StageID } is NaN` ) ;
157156 }
158157 const DATALINK = "../Data/Stage/" + StageID + ".js" ;
159158 DIV_PUZ_DISPLAY . style . display = "block" ;
160159 import ( DATALINK )
161- . then ( x => { DATA = object_copy ( x . default ) ; board_init ( ) } ) ;
160+ . then ( x => { DATA = object_copy ( x . default ) ; board_init ( ) } ) . catch ( x => { endscene ( ) ; throw x } ) ;
162161 } ;
163162 document . getElementById ( 'move_GAME' ) . onclick = startgame ;
164163}
0 commit comments