New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ado-improvements-1): Refactor reporter errors #1046
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9818fa8
Make ProgressReporter.failRun non-throwing
DaveTryon aef5178
Base process return code on scanner result
DaveTryon 613e8d4
Run prettier
DaveTryon 1bdfe69
Update some comments
DaveTryon 89b5762
Rename exit codes, tweak where they're used
DaveTryon 606e719
fix linting errors
DaveTryon e6c4a4d
Use ##[error] tag for Errors caught at top level
DaveTryon 5ad286a
Add alias to clarify intent of scanner return code
DaveTryon 15b52c4
Use GH-specific error syntax
DaveTryon File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import 'reflect-metadata'; | ||
import './module-name-mapper'; | ||
|
||
import { ExitCode } from '@accessibility-insights-action/shared'; | ||
import { Logger } from '@accessibility-insights-action/shared'; | ||
import { hookStderr } from '@accessibility-insights-action/shared'; | ||
import { hookStdout } from '@accessibility-insights-action/shared'; | ||
|
@@ -18,8 +19,8 @@ import { setupIocContainer } from './ioc/setup-ioc-container'; | |
await logger.setup(); | ||
|
||
const scanner = container.get(Scanner); | ||
await scanner.scan(); | ||
process.exit((await scanner.scan()) ? ExitCode.ScanCompletedNoUserActionIsNeeded : ExitCode.ScanCompletedUserActionIsNeeded); | ||
})().catch((error) => { | ||
console.log('Exception thrown in action: ', error); | ||
process.exit(1); | ||
console.log('::error::[Exception] Exception thrown in extension: ', error); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This uses the action error syntax described at https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message. I'll create a separate PR that uses this through the |
||
process.exit(ExitCode.ScanFailedToComplete); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
export const ExitCode = { | ||
ScanCompletedNoUserActionIsNeeded: 0, | ||
ScanCompletedUserActionIsNeeded: 1, | ||
ScanFailedToComplete: 2, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was about to ask if we should use a logger method instead here, but if I understand right, we don't have access to it in this scope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct. We get a Logger further upstream, but it a failure occurs before it's initialized, using console.log ensures that we can always produce the output