question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing brackets in else statment (C#)

See original GitHub issue

My generated code includes…

                        {
                            var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
                            throw new SwaggerException("Service Unavailable - The caller has hit a throttle or the request was rejected because the Atom is starting or stopping.", (int)response_.StatusCode, responseData_, headers_, null);
                        }
                        else
                        if (status_ == "522")
                        {
                            var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
                            throw new SwaggerException("Connection Timed Out - This message is returned to the client when the SOA Worker Maximum Execution Time has been exceeded.", (int)response_.StatusCode, responseData_, headers_, null);
                        }
                        else
                            var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
                        throw new SwaggerException("Unidentified Exception", (int)response_.StatusCode, responseData_, headers_, null);

Note the last else statement doesn’t have brackets around it. This causes a compiler error since responseData isn’t in the same scope as the throw statement that uses it.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:24 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
Grauenwolfcommented, Aug 13, 2018

Confirmed the issue is fixed on my machine using the latest build. Thank you for the quick turn-around and for this project in general. I couldn’t do my job without this tooling.

0reactions
Kuo-Chun-Tingcommented, Aug 10, 2018

ok. again

在 2018年8月10日 上午09:22,Rico Suter notifications@github.com 寫道:

It was truncated

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it a bad practice to use an if-statement without curly ...
Use braces for all if statements even the simple ones. Or, rewrite a simple if statement to use the ternary operator:
Read more >
coding style - Single statement if block - braces or no?
A single-statement block which is delimited by braces wastes one to two lines. ... Not so good, especially in C/C++-like languages:
Read more >
26/30, no curly brackets after "if" and "else"
Yes it is not necessary to use curly braces after conditions and loops (functions always need them) IF and only if there is...
Read more >
If blocks without curly braces ಠ_ಠ
The only situation where braces can be safely left out is when the single statement is on the same line as the "if"....
Read more >
Can I use nested statements without curly brackets?
If you are talking about C/C++ then you can use nested statements without curly brackets but it allows till only 1 line. Example:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found