Skip to content

Commit 02621d7

Browse files
joepie91ljharb
authored andcommitted
[readme] Add possible error types (#232)
1 parent 014d98d commit 02621d7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

readme.markdown

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ $ node example/sync.js
4343
var resolve = require('resolve');
4444
```
4545

46+
For both the synchronous and asynchronous methods, errors may have any of the following `err.code` values:
47+
48+
- `MODULE_NOT_FOUND`: the given path string (`id`) could not be resolved to a module
49+
- `INVALID_BASEDIR`: the specified `opts.basedir` doesn't exist, or is not a directory
50+
- `INVALID_PACKAGE_MAIN`: a `package.json` was encountered with an invalid `main` property (eg. not a string)
51+
4652
## resolve(id, opts={}, cb)
4753

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

0 commit comments

Comments
 (0)