How to use the codesandbox-api.transformError function in codesandbox-api

To help you get started, we’ve selected a few codesandbox-api 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 codesandbox / codesandbox-client / packages / sandbox-hooks / react-error-overlay / overlay.js View on Github external
if (!tModule && relevantFrame) {
        const fileName =
          relevantFrame._originalFileName || relevantFrame.fileName || '';
        tModule = manager.resolveTranspiledModule(
          fileName.replace(location.origin, ''),
          '/'
        );
      }

      if (!tModule) {
        return;
      }

      try {
        const transformation = transformError(
          errRef.error,
          tModule,
          manager.getTranspiledModules()
        );

        if (transformation) {
          const newError = new Error(transformation.name || errRef.error.name);
          newError.message = transformation.message;
          newError.suggestions = transformation.suggestions;
          newError.originalName = errRef.error.name;
          newError.originalMessage = errRef.error.message;
          errRef.error = newError;
        }
      } catch (ex) {
        /* just catch */
        console.error(ex);
github codesandbox / codesandbox-client / src / sandbox / react-error-overlay / overlay.js View on Github external
if (!tModule && relevantFrame) {
        const fileName =
          relevantFrame._originalFileName || relevantFrame.fileName || '';
        tModule = manager.resolveTranspiledModule(
          fileName.replace(location.origin, ''),
          '/'
        );
      }

      if (!tModule) {
        return;
      }

      try {
        const transformation = transformError(
          errRef.error,
          tModule,
          manager.getTranspiledModules()
        );

        if (transformation) {
          errRef.error.originalName = errRef.error.name;
          errRef.error.originalMessage = errRef.error.message;

          errRef.error.name = transformation.name || errRef.error.name;
          errRef.error.message = transformation.message;
          errRef.error.suggestions = transformation.suggestions;
        }
      } catch (ex) {
        /* just catch */
        console.error(ex);

codesandbox-api

[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![Greenkeeper badge](https://badges.greenkeeper.io/alexjoverm/typescript-library-starter.svg)](https://greenkeeper.io/) [![Travi

MIT
Latest version published 4 years ago

Package Health Score

73 / 100
Full package analysis

Similar packages