-
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.
feat: update to support contextual-error v2.0.0
Improves compatability with native Error cause BREAKING CHANGE: HttpError's static .cause() method was changed to .getCause(). Constructor arguments were consolidated, so there are now two optional arguments instead. Target ES version is now ES2022
- Loading branch information
1 parent
ce083b9
commit 157fff6
Showing
13 changed files
with
251 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: "🐛 Bug Report" | ||
about: Report a reproducible bug or regression. | ||
title: '' | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Current Behavior | ||
|
||
<!-- Describe how the issue manifests. --> | ||
|
||
## Expected Behavior | ||
|
||
<!-- Describe what the desired behavior would be. --> | ||
|
||
## Debug log | ||
|
||
<!-- Re-run the command with the --debug flag enabled and paste the output here --> |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
name: 🌈 Feature request | ||
about: Suggest an amazing new idea for this project | ||
title: '' | ||
labels: enhancement | ||
assignees: '' | ||
|
||
--- | ||
|
||
## Feature Request | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
<!-- A clear and concise description of what the problem is. Ex. I have an issue when [...] --> | ||
|
||
**Describe the solution you'd like** | ||
<!-- A clear and concise description of what you want to happen. Add any considered drawbacks. --> | ||
|
||
**Describe alternatives you've considered** | ||
<!-- A clear and concise description of any alternative solutions or features you've considered. --> | ||
|
||
## Are you willing to resolve this issue by submitting a Pull Request? | ||
|
||
<!-- | ||
Remember that first-time contributors are welcome! 🙌 | ||
--> | ||
|
||
- [ ] Yes, I have the time, and I know how to start. | ||
- [ ] Yes, I have the time, but I don't know how to start. I would need guidance. | ||
- [ ] No, I don't have the time, although I believe I could do it if I had the time... | ||
- [ ] No, I don't have the time and I wouldn't even know how to start. | ||
|
||
<!-- | ||
👋 Have a great day and thank you for the feature request! | ||
--> |
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!-- | ||
😀 Wonderful! Thank you for opening a pull request. | ||
Please fill in the information below to expedite the review | ||
and (hopefully) merge of your change. | ||
--> | ||
|
||
### Description of change | ||
|
||
<!-- | ||
Please be clear and concise what the change is intended to do, | ||
why this change is needed, and how you've verified that it | ||
corrects what you intended. | ||
In some cases it may be helpful to include the current behavior | ||
and the new behavior. | ||
If the change is related to an open issue, you can link it here. | ||
If you include `Fixes #0000` (replacing `0000` with the issue number) | ||
when this is merged it will automatically mark the issue as fixed and | ||
close it. | ||
--> | ||
|
||
### Pull-Request Checklist | ||
|
||
<!-- | ||
Please make sure to review and check all of the following. | ||
If an item is not applicable, you can add "N/A" to the end. | ||
--> | ||
|
||
- [ ] Code is up-to-date with the `main` branch | ||
- [ ] `npm run lint` passes with this change | ||
- [ ] `npm run test` passes with this change | ||
- [ ] This pull request links relevant issues as `Fixes #0000` | ||
- [ ] There are new or updated unit tests validating the change | ||
- [ ] Documentation has been updated to reflect this change | ||
- [ ] The new commits follow conventions outlined in the [conventional commit spec](https://www.conventionalcommits.org/en/v1.0.0/) | ||
|
||
<!-- | ||
🎉 Thank you for contributing! | ||
--> |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Pull Request | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [16.x, 22.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm ci | ||
- run: npm run build --if-present | ||
- run: npm test | ||
- name: Coverage check | ||
run: npm run cov:check |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Build | ||
run: npm run build | ||
- name: Test | ||
run: npm test | ||
- name: Coverage check | ||
run: npm run cov:check |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
22 |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Http Error: rich http errors | ||
|
||
[![Build Status](https://travis-ci.org/jdpnielsen/http-error.svg?branch=master)](https://travis-ci.org/jdpnielsen/http-error) | ||
![NPM Version](https://img.shields.io/npm/v/%40jdpnielsen%2Fhttp-error) | ||
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) | ||
|
||
The Http Error module is an extension of [Contextual Error](https://github.com/jdpnielsen/contextual-error), inspired by Hapi's [Boom]([email protected]:hapijs/boom.git). | ||
|
@@ -127,10 +127,11 @@ import HttpError from '@jdpnielsen/http-error'; | |
import { Info } from '@jdpnielsen/contextual-error'; | ||
export function custom(message?: string, input?: { cause?: Error, info?: Info, publicInfo?: Info }): HttpError { | ||
return new HttpError(500, 'Custom', message, input?.publicInfo, input?.cause, { | ||
name: 'customError', | ||
return new HttpError(500, 'Custom', message, input?.publicInfo, { | ||
name: 'customError', | ||
constructorOpt: custom, | ||
info: input?.info, | ||
cause: input?.cause, | ||
}); | ||
} | ||
``` |
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
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
Oops, something went wrong.