Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
//
// We wrap the server side state generation inside a try/catch to have the ability to fall back to an
// server AND client saga behavior if the state generation failed.
//
try {
const {store, rootSagaInstance} = createStoreContext({
reduxSagaContext: 'server'
});
await rootSagaInstance.done;
initialState = store.getState();
} catch (e) {
reduxSagaContext = 'universal';
errors.push(serialize(e));
}
return {
query,
reduxSagaContext,
errors,
initialState
};
}
return ( ...args )=>{
var action = null
try{
action = creator( ...args )
}
catch( e ){
action = {type: NEW_THROWN_ERR, error: true, payload: serializeError(e) }
}
finally{
return action // eslint-disable-line no-unsafe-finally
}
}
.then(({ id, value, reason }) => {
if (this.debug) {
console.log(
'[webview-crypto] Received message:',
JSON.stringify({
id,
value,
reason,
}),
);
}
if (!id) {
console.warn(
'[webview-crypto] no ID passed back from message:',
JSON.stringify(serializeError(reason)),
);
return;
}
const { resolve, reject } = this.messages[id];
if (value) {
resolve(value);
} else {
reject(reason);
}
delete this.messages[id];
})
.catch((reason) => {
pubsub,
socket,
storage,
availableRoomTypes,
onRoomDisposed,
request.type,
await roomFetcher.getListOfRooms(),
request.options,
customRoomIdGenerator
)
Logger(`${room.roomId} made`, LoggerTypes.room)
onRoomMade(room)
socket.emit(`${request.uniqueRequestId}-create`, room.roomId)
} catch (e) {
const error = serializeError(e)
Logger(
`${socket.id} error creating room - ${JSON.stringify(error)}`,
LoggerTypes.room
)
socket.emit(`${request.uniqueRequestId}-error`, error)
}
}
)
export function newThrownErr(err) {
return {
type: NEW_THROWN_ERR,
payload: serializeError(err)
}
}
lastAttemptedAt: Date.now()
};
const currentPath = input.path.slice(0, -1).concat([currentLink]);
scrapedLinkHistory = scrapedLinkHistory.concat([currentLink]);
let resource;
try {
resource = await scrape({
url: currentLink.linkUrl
});
} catch (error) {
log.error({
error: serializeError(error)
}, 'error has occured');
headlessCrawlerConfiguration.onError(error);
}
if (!resource) {
callback(null);
return;
}
log.debug('discovered %d new links', resource.links.length);
const shouldAdvance = await headlessCrawlerConfiguration.onResult(resource);
if (!shouldAdvance) {
this.cbMap.forEach(cb => {
if (promiseCallbackMap.has(cb)) {
cb({err: serializeError(new Error('Destroyed'))});
} else {
cb();
}
});
}
componentDidCatch (error, info) {
this.setState({ hasError: true, error: serializeError(error) })
log.error(JSON.stringify(serializeError(error)))
}
const shows = (state = initialState, action) => {
switch (action.type) {
case SHOWS_IS_LOADING:
return { ...state, isLoading: action.isLoading };
case SHOWS_FETCH_DATA_SUCCESS:
return { ...state, shows: action.shows };
case SHOWS_FETCH_DATA_ERROR:
return {
...state,
error: serializeError(action.error),
};
default:
return state;
}
};
componentDidCatch (error, info) {
this.setState({ hasError: true, error: serializeError(error) })
log.error(JSON.stringify(serializeError(error)))
}