Skip to content

Commit d19841b

Browse files
committed
Add documentation about package.json bugs.url
1 parent 5137325 commit d19841b

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,28 @@ throw new ExampleError('...', {
109109
})
110110
```
111111

112+
## Using `package.json`
113+
114+
```json
115+
// package.json
116+
// See https://docs.npmjs.com/cli/configuring-npm/package-json#bugs
117+
{
118+
...
119+
"bugs": {
120+
"url": "https://github.com/my-name/my-project/issues"
121+
},
122+
...
123+
}
124+
```
125+
126+
```js
127+
import packageJson from '../../package.json' with { type: 'json' }
128+
129+
export const UnknownError = BaseError.subclass('UnknownError', {
130+
bugs: packageJson.bugs.url,
131+
})
132+
```
133+
112134
# Related projects
113135

114136
- [`modern-errors`](https://github.com/ehmicky/modern-errors): Handle errors in

0 commit comments

Comments
 (0)