You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There doesn't seem to be any mention of exception handling, or how to format Try-catch blocks, on the style guide at all.
What's the opinion on this? If we're using them, then we should probably have an example somewhere, similar to how we have examples for 'for, if, switch' etc. And if it's discouraged, it should probably be stated.
Extra info about linter & try-catch
By default, the linter doesn't error on this format:
try
{
// code here
}
catch(Error& error) // note that there is no space before the bracket
{
// code here
}
(Technically, it doesn't even assume try-catch blocks in the code. According to the Google style guide, Google C++ programmers "do not use c++ exceptions!")
Although, a one-line modification to the linter will also allow these two more common formats:
Also: I skimmed the codebase with Ctrl+F (cmd+F) and found only 3 try-catch blocks in last year's repo so far, all in src/telemetry (/sendloop.cpp, /recvloop.cpp, /main.cpp) all using the last style shown.
The text was updated successfully, but these errors were encountered:
There doesn't seem to be any mention of exception handling, or how to format Try-catch blocks, on the style guide at all.
What's the opinion on this? If we're using them, then we should probably have an example somewhere, similar to how we have examples for 'for, if, switch' etc. And if it's discouraged, it should probably be stated.
Extra info about linter & try-catch
By default, the linter doesn't error on this format:
(Technically, it doesn't even assume try-catch blocks in the code. According to the Google style guide, Google C++ programmers "do not use c++ exceptions!")
Although, a one-line modification to the linter will also allow these two more common formats:
Also: I skimmed the codebase with Ctrl+F (cmd+F) and found only 3 try-catch blocks in last year's repo so far, all in src/telemetry (/sendloop.cpp, /recvloop.cpp, /main.cpp) all using the last style shown.
The text was updated successfully, but these errors were encountered: