Skip to content

Commit

Permalink
refactor: improve logging when maven resources are not available (#12360
Browse files Browse the repository at this point in the history
)
  • Loading branch information
antonmos committed Oct 30, 2021
1 parent ab72e9d commit 40737c4
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lib/datasource/maven/util.ts
Expand Up @@ -115,7 +115,10 @@ export async function isHttpResourceExists(
}

const failedUrl = pkgUrl.toString();
logger.debug({ failedUrl }, `Can't check HTTP resource existence`);
logger.debug(
{ failedUrl, statusCode: err.statusCode },
`Can't check HTTP resource existence`
);
return null;
}
}
Expand All @@ -141,12 +144,15 @@ export async function downloadMavenXml(
}
let rawContent: string;
let authorization: boolean;
let statusCode: number;
switch (pkgUrl.protocol) {
case 'http:':
case 'https:':
({ authorization, body: rawContent } = await downloadHttpProtocol(
pkgUrl
));
({
authorization,
body: rawContent,
statusCode,
} = await downloadHttpProtocol(pkgUrl));
break;
case 's3:':
logger.debug('Skipping s3 dependency');
Expand All @@ -157,7 +163,10 @@ export async function downloadMavenXml(
}

if (!rawContent) {
logger.debug(`Content is not found for Maven url: ${pkgUrl.toString()}`);
logger.debug(
{ url: pkgUrl.toString(), statusCode },
`Content is not found for Maven url`
);
return {};
}

Expand Down

0 comments on commit 40737c4

Please sign in to comment.