Skip to content

Commit 677b1ed

Browse files
committed
Implementation of RFC9457
1 parent 72ac00d commit 677b1ed

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/yarnpkg-core/sources/httpUtils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ async function prettyNetworkError(response: Promise<Response>, {configuration, c
5858
message += `(can be increased via ${formatUtils.pretty(configuration, `httpTimeout`, formatUtils.Type.SETTING)})`;
5959

6060
const networkError = new ReportError(MessageName.NETWORK_ERROR, message, report => {
61+
if (err.response?.headers[`content-type`]?.includes(`application/problem+json`) && err.response?.body) {
62+
report.reportError(MessageName.NETWORK_ERROR, ` ${formatUtils.prettyField(configuration, {
63+
label: `RFC9457`,
64+
value: formatUtils.tuple(formatUtils.Type.INSPECT, err.response.body.toString()),
65+
})}`);
66+
}
67+
6168
if (err.response) {
6269
report.reportError(MessageName.NETWORK_ERROR, ` ${formatUtils.prettyField(configuration, {
6370
label: `Response Code`,

0 commit comments

Comments
 (0)