-
Notifications
You must be signed in to change notification settings - Fork 177
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(Archicad): CNX-8392 Handle CA1031 warnings in ArchiCAD projects #3122
Conversation
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.
Just some minor changes around logging
catch (ArgumentNullException) | ||
{ | ||
return null; | ||
} | ||
catch (TaskCanceledException) | ||
{ | ||
return null; | ||
} | ||
catch (ObjectDisposedException) |
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'm assuming Execute
cannot throw within? If so, would we want to add logging to some these since we're swallowing them?
@@ -27,7 +27,15 @@ internal class AsyncCommandProcessor | |||
{ | |||
return Task.Run(command.Execute, token); | |||
} | |||
catch (Exception e) | |||
catch (ArgumentNullException) |
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 think this one is only going to throw if command.Execute
is null, which can't be the case since it's part of the ICommand interface.
I think we don't really need to catch this as it would really be an unexpected event (provided input was invalid somehow)
{ | ||
throw; | ||
SpeckleLog.Logger.Warning("Failed to convert element type {elementType}", elementType.ToString()); |
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.
Warnings should also include their exception if it exists as first argument.
} | ||
catch (Exception) | ||
catch (ObjectDisposedException) | ||
{ | ||
SpeckleLog.Logger.Warning("Failed to convert element type {elementType}", elementType.ToString()); |
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.
Same here, including the exception makes the warning more useful in our logs.
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.
Changes from my comments look good. In we go 🚀
return null; | ||
} | ||
catch (ObjectDisposedException) | ||
catch (Exception ex) when (ex is TaskCanceledException or ObjectDisposedException) |
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.
Legit
Description & motivation
Handle CA1031 warnings in ArchiCAD projects
https://spockle.atlassian.net/browse/CNX-8392
Changes:
Specific exceptions used.
Checklist: