Skip to content

Commit

Permalink
fix: formatting, error-handling (#119)
Browse files Browse the repository at this point in the history
* fix(cli+core): case study bugfixes

* fix(core): expand string detection

* fix(cli): conflicts+biome fixes

* docs(core): add comment explaining silencing a common error

* style(core): missing comma

---------

Co-authored-by: Mateusz Jarzębowski-Bownik <[email protected]>
  • Loading branch information
matt-jb and Mateusz Jarzębowski-Bownik authored Dec 3, 2024
1 parent 0dd3cd3 commit fc30f35
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function FailureResult({
<CompliantMessage count={groupedByStatus.whitelist.length} />
</Box>
)}
<Box>
<Box marginTop={verbose && hasWhitelisted ? 1 : 0}>
<BlacklistedMessage count={groupedByStatus.blacklist.length} />
</Box>
<LicenseList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function IncludingUnknownResult({
)}
{hasBlacklisted && (
<>
<Box>
<Box marginTop={verbose && hasWhitelisted ? 1 : 0}>
<BlacklistedMessage count={groupedByStatus.blacklist.length} />
</Box>
<LicenseList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function NotFoundResult({
{verbose ? (
<Text>
{" "}
{packageName}: {packagePath} Error: {errorMessage}
{packageName}: {errorMessage}
</Text>
) : (
<Text> {packageName} </Text>
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/dependency-finder/exec-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function execCommand(
exec(command, { cwd }, (error, stdout, stderr) => {
if (stderr && !stderr.includes("Debugger attached")) {
reject(
new ExecCommandException(`Command "${command}" returned error.`, {
new ExecCommandException(`Command "${command}" returned an error.`, {
originalError: error,
stdout,
stderr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ export function parseLicenseLogicalExpression(
try {
return parse(licenseExpression);
} catch (error) {
console.error(error);
// Most common error when spdx-expression-parse fails to parse the license expression.
// The error message thrown is not very useful, hence we silence it.
if (!(error instanceof Error && error.message.startsWith("Unexpected"))) {
console.error(error);
}
return undefined;
}
}
Expand Down

0 comments on commit fc30f35

Please sign in to comment.