Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
24 changes: 0 additions & 24 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

72 changes: 0 additions & 72 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

7 changes: 2 additions & 5 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@ name: CI
on:
push:
branches: [ master ]

pull_request:
branches: [ master ]

workflow_dispatch: {}

jobs:
Job:
name: Node.js
uses: artusjs/github-actions/.github/workflows/node-test.yml@v1
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Consider using a specific version tag instead of 'master'

The job source has been updated to use the master branch of the node-modules/github-actions repository. While this ensures you're always using the latest version, it may introduce instability to your CI process if there are breaking changes in the upstream repository.

Consider using a specific version tag instead:

-    uses: node-modules/github-actions/.github/workflows/node-test.yml@master
+    uses: node-modules/github-actions/.github/workflows/node-test.yml@v1

Replace v1 with the latest stable version available in the node-modules/github-actions repository.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uses: node-modules/github-actions/.github/workflows/node-test.yml@master
uses: node-modules/github-actions/.github/workflows/node-test.yml@v1

with:
os: 'ubuntu-latest, macos-latest, windows-latest'
version: '14, 16, 18'
version: '14, 16, 18, 20, 22'
6 changes: 1 addition & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ on:
push:
branches: [ master ]

workflow_dispatch: {}

jobs:
release:
name: Node.js
uses: artusjs/github-actions/.github/workflows/node-release.yml@v1
uses: eggjs/github-actions/.github/workflows/node-release.yml@master
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
with:
checkTest: false
File renamed without changes.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) Alibaba Group Holding Limited and other contributors.
Copyright (c) 2017-present Alibaba Group Holding Limited and other contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ Default error handling plugin for egg.
## Install

```bash
$ npm i egg-onerror
npm i egg-onerror
```

## Usage

`egg-onerror` is on by default in egg. But you still can configure its properties to fits your scenarios.

- `errorPageUrl: String or Function` - If user request html pages in production environment and unexpected error happened, it will redirect user to `errorPageUrl`.
- `accepts: Function` - detect user's request accpet `json` or `html`.
- `accepts: Function` - detect user's request accept `json` or `html`.
- `all: Function` - customize error handler, if `all` present, negotiation will be ignored.
- `html: Function` - customize html error handler.
- `text: Function` - customize text error handler.
Expand All @@ -37,7 +37,7 @@ $ npm i egg-onerror

```js
// config.default.js
// errorPageUrl support funtion
// errorPageUrl support function
exports.onerror = {
errorPageUrl: (err, ctx) => ctx.errorPageUrl || '/500',
};
Expand All @@ -56,3 +56,9 @@ Please open an issue [here](https://github.com/eggjs/egg/issues).
## License

[MIT](https://github.com/eggjs/egg-onerror/blob/master/LICENSE)

## Contributors

[![Contributors](https://contrib.rocks/image?repo=eggjs/egg-onerror)](https://github.com/eggjs/egg-onerror/graphs/contributors)

Made with [contributors-img](https://contrib.rocks).
2 changes: 0 additions & 2 deletions agent.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

module.exports = agent => {
// should watch error event
agent.on('error', err => {
Expand Down
2 changes: 0 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const http = require('http');
const fs = require('fs');
const onerror = require('koa-onerror');
Expand Down
2 changes: 0 additions & 2 deletions config/config.default.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

const path = require('path');

exports.onerror = {
Expand Down
2 changes: 0 additions & 2 deletions lib/error_view.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

// modify from https://github.com/poppinss/youch/blob/develop/src/Youch/index.js

const fs = require('fs');
Expand Down
2 changes: 0 additions & 2 deletions lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

exports.detectErrorMessage = function(ctx, err) {
// detect json parse error
if (err.status === 400 &&
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"onerror"
],
"dependencies": {
"cookie": "^0.3.1",
"cookie": "^0.7.2",
"koa-onerror": "^4.0.0",
"mustache": "^2.3.0",
"stack-trace": "^0.0.10"
Expand All @@ -41,8 +41,8 @@
},
"scripts": {
"test": "npm run lint -- --fix && npm run test-local",
"test-local": "egg-bin test --full-trace",
"cov": "egg-bin cov --full-trace",
"test-local": "egg-bin test",
"cov": "egg-bin cov",
"lint": "eslint .",
"ci": "npm run lint && npm run cov"
},
Expand Down
Loading