Skip to content

Commit

Permalink
[readme] Add possible error types (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
joepie91 authored and ljharb committed Oct 25, 2020
1 parent 014d98d commit 02621d7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ $ node example/sync.js
var resolve = require('resolve');
```

For both the synchronous and asynchronous methods, errors may have any of the following `err.code` values:

- `MODULE_NOT_FOUND`: the given path string (`id`) could not be resolved to a module
- `INVALID_BASEDIR`: the specified `opts.basedir` doesn't exist, or is not a directory
- `INVALID_PACKAGE_MAIN`: a `package.json` was encountered with an invalid `main` property (eg. not a string)

## resolve(id, opts={}, cb)

Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`.
Expand Down

0 comments on commit 02621d7

Please sign in to comment.