generated from NickKelly1/nkp-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc8152c
commit 733c237
Showing
6 changed files
with
65 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,34 @@ | ||
# @nkp/error | ||
|
||
Coerce an unknown error into an instance of the Error class | ||
[](https://badge.fury.io/js/%40nkp%2Ferror) | ||
[](https://github.com/NickKelly1/nkp-error/actions/workflows/npm-publish.yml) | ||
 | ||
|
||
## Examples | ||
Coerce an unknown error into an instance of the Error class. | ||
|
||
## Installation | ||
|
||
This package exports as CommonJS (default), ES Modules, and UMD. | ||
|
||
For ES Modules and tree shaking use a bundler that supports ES modules such as [rollup](https://rollupjs.org/guide/en/) or [webpack](https://webpack.js.org/). | ||
|
||
### With npm | ||
|
||
```sh | ||
npm install @nkp/error | ||
``` | ||
|
||
### With script tags | ||
|
||
```html | ||
<head> | ||
<!-- insert your desired version --> | ||
<script src="https://unpkg.com/browse/@nkp/[email protected]/"></script> | ||
</head> | ||
|
||
``` | ||
|
||
## Usage | ||
|
||
```ts | ||
try { | ||
|
@@ -26,12 +52,12 @@ catch(error) { assert(typeof error === 'string') | |
in this case, since a `string` is thrown and not an `Error` instance, there is no way to obtain the stack trace from the thrown point. Instead, `coerceError` will start the stack trace in the `catch` block. | ||
## Releasing a new version | ||
## Publishing | ||
To a release a new version: | ||
1. Update the version number in package.json | ||
2. Push the new version to the `master` branch on GitHub | ||
3. Create a `new release` on GitHub for the latest version | ||
This will trigger a GitHub action that tests and publishes the npm package. | ||
A GitHub action will test and publishes the npm package. Note, the `dist` folder is published. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters