|
| 1 | +/* eslint-disable lines-between-class-members */ |
1 | 2 | import { |
2 | 3 | CLONE_EXPERIMENT, |
3 | 4 | GET_EXPERIMENTS, |
@@ -47,7 +48,7 @@ export const processError = (response) => { |
47 | 48 | return { |
48 | 49 | errorMessage: parsedResponse.message, |
49 | 50 | errorDetails: parsedResponse.details, |
50 | | - additionalInfo: parsedResponse.additionalInfo |
| 51 | + additionalInfo: parsedResponse.additionalInfo, |
51 | 52 | }; |
52 | 53 | } |
53 | 54 | return false; |
@@ -117,18 +118,17 @@ const simulateNetwork = (payload) => createSimulateBackendCall( |
117 | 118 |
|
118 | 119 | class PythonMessageFilter { |
119 | 120 | errorIds = new Set(); |
120 | | - shouldLaunch(e) { |
| 121 | + shouldLaunch (e) { |
121 | 122 | const errorId = e.additionalInfo?.sim_id ; |
122 | | - if (!errorId) |
123 | | - return true ; |
124 | | - if (errorId) |
125 | | - { |
126 | | - if(this.errorIds.has(errorId)) |
127 | | - return false ; |
128 | | - else { |
129 | | - this.errorIds.add(errorId); |
130 | | - return true ; |
| 123 | + if (!errorId) { |
| 124 | + return true; |
| 125 | + } |
| 126 | + if (errorId) { |
| 127 | + if (this.errorIds.has(errorId)) { |
| 128 | + return false; |
131 | 129 | } |
| 130 | + this.errorIds.add(errorId); |
| 131 | + return true; |
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
@@ -167,10 +167,10 @@ export default (store) => (next) => (action) => { |
167 | 167 |
|
168 | 168 | const pythonErrorCallback = (error) => { |
169 | 169 | console.debug(Utils.getPlainStackTrace(error.errorDetails)); |
170 | | - if (errorMessageFilter.shouldLaunch(error)) |
| 170 | + if (errorMessageFilter.shouldLaunch(error)) { |
171 | 171 | return next(openBackendErrorDialog(error)); |
172 | | - else |
173 | | - return next(action); |
| 172 | + } |
| 173 | + return next(action); |
174 | 174 | }; |
175 | 175 |
|
176 | 176 | switch (action.type) { |
@@ -219,13 +219,18 @@ export default (store) => (next) => (action) => { |
219 | 219 | break; |
220 | 220 | } |
221 | 221 | case CREATE_SIMULATE_NETWORK: { |
222 | | - const payload = { allTrials: false, simId: new Date().getTime() } |
| 222 | + const payload = { allTrials: false, simId: new Date().getTime() }; |
223 | 223 | simulateNetwork(payload) |
224 | 224 | .then(toNetworkCallback(false), pythonErrorCallback); |
225 | 225 | break; |
226 | 226 | } |
227 | 227 | case SIMULATE_NETWORK: |
228 | | - const payload = { allTrials: action.payload, simId: new Date().getTime(), usePrevInst: false } |
| 228 | + // eslint-disable-next-line no-case-declarations |
| 229 | + const payload = { |
| 230 | + allTrials: action.payload, |
| 231 | + simId: new Date().getTime(), |
| 232 | + usePrevInst: false, |
| 233 | + }; |
229 | 234 | simulateNetwork(payload) |
230 | 235 | .then(toNetworkCallback(false), pythonErrorCallback); |
231 | 236 | break; |
|
0 commit comments