Socket
Socket
Sign inDemoInstall

babel-errors

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-errors

Nicer error messages for Babel


Version published
Weekly downloads
790
decreased by-18.89%
Maintainers
1
Weekly downloads
 
Created
Source

babel-errors

Nicer error messages for Babel

import createBabelFile from 'babel-file';
import {BabelError, prettyError, buildCodeFrameError} from 'babel-errors';

const file = createBabelFile(...);

let path = file.path;
let {line, column} = path.loc.start;

throw prettyError(createErrorWithLoc('Error at this position', line, column));
throw buildCodeFrameError(path, 'Error with this Path');

createErrorWithLoc(message, line, column)

This lets you add location information to your errors.

wrapErrorWithCodeFrame(err)

You can use this when capturing errors thrown by Babel or constructed using createErrorWithLoc to add a code frame when possible.

buildCodeFrameError(path, message)

You can use this to build a code frame error around a path with a specified message.

Use this instead of path.buildCodeFrameError when you aren't running inside a Babel plugin.

toErrorStack(error)

Creates string with error name, message, stack/code frame.

FAQs

Package last updated on 29 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc