@@ -106,6 +106,33 @@ const simulateNetwork = (payload) => createSimulateBackendCall(
106106 GEPPETTO . Resources . RUNNING_SIMULATION ,
107107) ;
108108
109+ class ErrorDialogManager {
110+ errorTag = 'SimulationId ' ;
111+ errorIds = [ ] ;
112+ addId ( id ) { this . errorIds . push ( id ) ; }
113+ getErrorId ( s ) {
114+ let errorId = 0 ;
115+ const i = s . indexOf ( this . errorTag ) ;
116+ if ( i > - 1 )
117+ errorId = parseFloat ( s . substring ( i + this . errorTag . length , s . length - 1 ) ) ;
118+ return errorId ;
119+ }
120+ shouldLaunch ( s ) {
121+ const errorId = this . getErrorId ( s ) ;
122+ if ( this . errorIds . indexOf ( errorId ) == - 1 && errorId > 0 )
123+ {
124+ this . errorIds . push ( errorId ) ;
125+ return true ;
126+ }
127+ if ( errorId == 0 )
128+ return true ;
129+ if ( this . errorIds . indexOf ( errorId ) >= 0 )
130+ return false ;
131+ }
132+ }
133+
134+ const errorDialogManager = new ErrorDialogManager ( ) ;
135+
109136export default ( store ) => ( next ) => ( action ) => {
110137 const switchLayoutAction = ( edit = true , reset = true ) => {
111138 previousLayout [ store . getState ( ) . general . editMode ? 'edit' : 'network' ] = store . getState ( ) . layout ;
@@ -129,7 +156,10 @@ export default (store) => (next) => (action) => {
129156
130157 const pythonErrorCallback = ( error ) => {
131158 console . debug ( Utils . getPlainStackTrace ( error . errorDetails ) ) ;
132- return next ( openBackendErrorDialog ( error ) ) ;
159+ if ( errorDialogManager . shouldLaunch ( error . errorMessage ) )
160+ return next ( openBackendErrorDialog ( error ) ) ;
161+ else
162+ return next ( action ) ;
133163 } ;
134164
135165 switch ( action . type ) {
@@ -166,12 +196,14 @@ export default (store) => (next) => (action) => {
166196 break ;
167197 }
168198 case CREATE_SIMULATE_NETWORK : {
169- simulateNetwork ( { allTrials : false } )
199+ const payload = { allTrials : false , simId : new Date ( ) . getTime ( ) }
200+ simulateNetwork ( payload )
170201 . then ( toNetworkCallback ( false ) , pythonErrorCallback ) ;
171202 break ;
172203 }
173204 case SIMULATE_NETWORK :
174- simulateNetwork ( { allTrials : action . payload , usePrevInst : false } )
205+ const payload = { allTrials : action . payload , simId : new Date ( ) . getTime ( ) , usePrevInst : false }
206+ simulateNetwork ( payload )
175207 . then ( toNetworkCallback ( false ) , pythonErrorCallback ) ;
176208 break ;
177209 case PYTHON_CALL : {
0 commit comments