fetchFrames.js (780B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ 4 5 import { getIsPaused } from "../../selectors/index"; 6 7 export function fetchFrames(thread) { 8 return async function ({ dispatch, client, getState }) { 9 let frames; 10 try { 11 frames = await client.getFrames(thread); 12 } catch (e) { 13 // getFrames will fail if the thread has resumed. In this case the thread 14 // should no longer be valid and the frames we would have fetched would be 15 // discarded anyways. 16 if (getIsPaused(getState(), thread)) { 17 throw e; 18 } 19 } 20 dispatch({ type: "FETCHED_FRAMES", thread, frames }); 21 }; 22 }