Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Timeout - Task Cancelled Exception #184

Merged
merged 2 commits into from
Feb 23, 2023
Merged

fix Timeout - Task Cancelled Exception #184

merged 2 commits into from
Feb 23, 2023

Conversation

tomchavakis
Copy link
Owner

This PR is related with the following issue:
#182

src/Methods.cs Outdated
@@ -1055,6 +1064,11 @@ public async Task ExportLicenseTexts(List<LibraryInfo> infos)
// handled in !IsSuccessStatusCode, ignoring to continue export
break;
}
catch(TaskCanceledException ex)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTTP Client sometimes throws an OperationCanceledException as well. Because TaskCanceledException derives from OperationCanceledException we can catch OperationCanceledException and slightly adjust our log message to handle both exceptions.

Suggested change
catch(TaskCanceledException ex)
catch(OperationCanceledException ex)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the recommendation. I pushed a new commit.

src/Methods.cs Outdated
@@ -1055,6 +1064,11 @@ public async Task ExportLicenseTexts(List<LibraryInfo> infos)
// handled in !IsSuccessStatusCode, ignoring to continue export
break;
}
catch(TaskCanceledException ex)
{
WriteOutput($"Task Cancelled Exception during download of license url {info.LicenseUrl} exception {ex.Message}", logLevel: LogLevel.Verbose);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WriteOutput($"Task Cancelled Exception during download of license url {info.LicenseUrl} exception {ex.Message}", logLevel: LogLevel.Verbose);
WriteOutput($"{ex.GetType().Name} during download of license url {info.LicenseUrl} exception {ex.Message}", logLevel: LogLevel.Verbose);

@tomchavakis tomchavakis merged commit 9345754 into master Feb 23, 2023
@delete-merged-branch delete-merged-branch bot deleted the ftr-tmp-canc branch February 23, 2023 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants