BUG: as-promise.js should not silently fail, it should display the body of error responses to the user.
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 28/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript
- Domain
- release
Research direction
Read the error path around parseBody in as-promise.js and trace how the semantic-release GitLab plugin surfaces HTTPError responses. Reproduce the reported 400 response and confirm that its response body is displayed to the user rather than silently omitted.
Written by the indexing model from the issue text.
Description
I am able to show that as-promise.js has a silent failure mode where the body of the request that results in an error is not displayed to the user.
This is not the right place to solve this problem, but I could prove the body was not being reflected to the user by modifying this,
const parseBody = (body, responseType, encoding) => {
if (responseType === 'json') {
return body.length === 0 ? '' : JSON.parse(body.toString());
}
if (responseType === 'buffer') {
return Buffer.from(body);
}
if (responseType === 'text') {
return body.toString(encoding);
}
throw new TypeError(`Unknown body type '${responseType}'`);
};
const parseBody = (body, responseType, encoding) => {
console.log( {responseType, body: body.toString(encoding)} );
This gave me much needed contextual information about
[12:29:11 PM] [semantic-release] › ✖ An error occurred while running semantic-release: HTTPError: Response code 400 (Bad Request)
at EventEmitter.<anonymous> (/home/ecarroll/n/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/as-promise.js:118:31)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {
pluginName: '@semantic-release/gitlab'
}
HTTPError: Response code 400 (Bad Request)
at EventEmitter.<anonymous> (/home/ecarroll/n/lib/node_modules/@semantic-release/gitlab/node_modules/got/dist/source/as-promise.js:118:31)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {
pluginName: '@semantic-release/gitlab'
}%
this error, such that I could see,
{
responseType: 'text',
body: '{"message":"Validation failed: Links have duplicate values (cpanel-angular-validators.js) for #\\u003cRelease:0x00007f0702a43908\\u003e scope"}'
}```
**Note this ticket is for displaying the body of an error response to the user**
- Dominant language
- JavaScript
- Stars
- 344
- Forks
- 89
- Avg merge
- 16h 11m
- Merged PRs (30d)
- 4
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from semantic-release/gitlab
-
bug feature
Difficulty 4/5 3-5 days Newbie friendliness 48/100
semantic-release/gitlab#891 · 28 comments · 15 reactions ·
-
feature
Difficulty 4/5 3-5 days Newbie friendliness 35/100
semantic-release/gitlab#857 · 1 reaction ·
-
feature
Difficulty 4/5 3-5 days Newbie friendliness 35/100
semantic-release/gitlab#851 ·
-
feature help wanted
Difficulty 4/5 3-5 days Newbie friendliness 45/100
semantic-release/gitlab#830 · 5 comments ·
-
feature
semantic-release/gitlab#822 · 1 comment · 3 reactions · 1 assignee ·
All issues in semantic-release/gitlab
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·