Skip to content

Commit

Permalink
feat(server): improve logging (#1274)
Browse files Browse the repository at this point in the history
* feat(server): improve logging

Signed-off-by: Adam Setch <adam.setch@outlook.com>

* feat(server): improve logging

Signed-off-by: Adam Setch <adam.setch@outlook.com>

---------

Signed-off-by: Adam Setch <adam.setch@outlook.com>
  • Loading branch information
setchy committed Jul 26, 2024
1 parent c4f812f commit c10cf16
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,17 @@ const start = (options) => {
let bomNSData = (await createBom(srcDir, reqOptions)) || {};
bomNSData = postProcess(bomNSData, reqOptions);
if (reqOptions.serverUrl && reqOptions.apiKey) {
console.log("Publishing SBOM to Dependency Track");
console.log(
`Publishing SBOM ${reqOptions.projectName} to Dependency Track`,
reqOptions.serverUrl,
);
const response = await submitBom(reqOptions, bomNSData.bomJson);
const errorMessages = response?.errors;
if (errorMessages) {
res.writeHead(500, { "Content-Type": "application/json" });
return res.end(
JSON.stringify({
error: "Unable to submit the SBOM to the Dependency-Track server",
error: `Unable to submit the SBOM ${reqOptions.projectName} to the Dependency Track server ${reqOptions.serverUrl}`,
details: errorMessages,
}),
);
Expand Down

0 comments on commit c10cf16

Please sign in to comment.