Skip to content

Commit

Permalink
fix: include error message in write failure logs
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Feb 7, 2021
1 parent bf8391b commit 84100b7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async function scanRepo(repository: string) {
try {
writeResults(results, repository);
} catch (e) {
logger.onWriteFailure(repository);
logger.onWriteFailure(repository, e);
}

logger.onLintEnd(repository, results.length);
Expand Down
4 changes: 2 additions & 2 deletions lib/progress-logger/log-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ export const CLONE_FAILURE_TEMPLATE = (repository: string): string =>
export const READ_FAILURE_TEMPLATE = (repository: string): string =>
`[ERROR] ${repository} failed to read files`;

export const WRITE_FAILURE_TEMPLATE = (repository: string): string =>
`[ERROR] ${repository} failed to write results`;
export const WRITE_FAILURE_TEMPLATE = (repository: string, e: Error): string =>
`[ERROR] ${repository} failed to write results: ${e.message}`;

export const OVERFLOWING_ROWS_TOP = (overflowingRowCount: number): string =>
`[\u25B2 to see ${overflowingRowCount} lines above]`;
Expand Down
4 changes: 2 additions & 2 deletions lib/progress-logger/progress-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,9 @@ class ProgressLogger {
/**
* Log error about result writing failure
*/
onWriteFailure(repository: string) {
onWriteFailure(repository: string, error: Error) {
this.addNewMessage({
content: Templates.WRITE_FAILURE_TEMPLATE(repository),
content: Templates.WRITE_FAILURE_TEMPLATE(repository, error),
color: 'red',
level: 'error',
});
Expand Down

0 comments on commit 84100b7

Please sign in to comment.