Skip to content
This repository was archived by the owner on Feb 10, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: PR Build
on: pull_request
jobs:
code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: lts/*
- run: npm ci
- run: npm run lint
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
push:
branches:
- master
jobs:
deploy:
name: Publish
runs-on: ubuntu-latest
environment: development
steps:
- uses: actions/checkout@v3
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Install_token
id: install
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
shell: bash
- name: NPM_install
id: npm_install
run: |
npm ci
- name: publish npm module
if: github.ref == 'refs/heads/master'
run: npm publish
shell: bash
14 changes: 12 additions & 2 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,16 @@ export const assert = (value: any, message: string, context?: {}): void => {
}
}

export const newOperationalOops = (message: string, context?: {}) => {
export const newOperationalOops = (
message: string,
context?: {},
cause?: Error
) => {
return new Oops({
message,
category: constants.OperationalError,
context,
cause,
})
}

Expand All @@ -109,11 +114,16 @@ export const operationalOops = (message: string, context?: {}) => {
throw newOperationalOops(message, context)
}

export const newProgrammerOops = (message: string, context?: {}) => {
export const newProgrammerOops = (
message: string,
context?: {},
cause?: Error
) => {
return new Oops({
message,
category: constants.ProgrammerError,
context,
cause,
})
}

Expand Down
46 changes: 23 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oops-error",
"version": "2.4.0",
"version": "2.4.2",
"description": "",
"main": "./dist/lib/index.js",
"scripts": {
Expand All @@ -21,17 +21,17 @@
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@types/node": "^18.11.18",
"@types/node": "^18.13.0",
"chai": "^4.3.7",
"husky": "^8.0.3",
"mocha": "^10.2.0",
"prettier": "^2.8.1",
"prettier": "^2.8.4",
"sinon": "^15.0.1",
"ts-mocha": "^10.0.0",
"ts-node": "^10.9.1",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0",
"typescript": "^4.9.4"
"typescript": "^4.9.5"
},
"files": [
"dist/lib",
Expand Down