How to use the serialize-error function in serialize-error

To help you get started, we’ve selected a few serialize-error examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ImmoweltGroup / create-react-microservice / packages / create-react-microservice-scaffold / src / packages / my-fancy-ui / src / app.js View on Github external
//
    // 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
    };
  }
github swagger-api / swagger-ui / src / core / system.js View on Github external
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
        }
      }
github SocialXNetwork / socialx_react_native / packages / webview-crypto / src / MainWorker.ts View on Github external
.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) => {
github gimkit / blueboat / src / lib / server / Connection / ConnectionHandler.ts View on Github external
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)
      }
    }
  )
github PacktPublishing / Building-Enterprise-JavaScript-Applications / Chapter10 / hobnob / docs / src / core / plugins / err / actions.js View on Github external
export function newThrownErr(err) {
  return {
      type: NEW_THROWN_ERR,
      payload: serializeError(err)
  }
}
github gajus / headless-crawler / src / factories / createHeadlessCrawler.js View on Github external
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) {
github Feverqwe / tSearch / src / tools / transport.js View on Github external
this.cbMap.forEach(cb => {
      if (promiseCallbackMap.has(cb)) {
        cb({err: serializeError(new Error('Destroyed'))});
      } else {
        cb();
      }
    });
  }
github Netflix-Skunkworks / stethoscope-app / src / ErrorBoundary.js View on Github external
componentDidCatch (error, info) {
    this.setState({ hasError: true, error: serializeError(error) })
    log.error(JSON.stringify(serializeError(error)))
  }
github stanleyfok / nextjs-template / redux / reducers / shows.js View on Github external
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;
  }
};
github Netflix-Skunkworks / stethoscope-app / src / ErrorBoundary.js View on Github external
componentDidCatch (error, info) {
    this.setState({ hasError: true, error: serializeError(error) })
    log.error(JSON.stringify(serializeError(error)))
  }

serialize-error

Serialize/deserialize an error into a plain object

MIT
Latest version published 11 months ago

Package Health Score

85 / 100
Full package analysis