Thoughts on using curly-brackets-less while loop with a try/catch? I need to fetch data from an server that isn't always reliable and unfortunately fixing that is out of my hands. My team determined we would attempt the request up to 3 times.

So I thought of using a try-catch inside the while loop but didn't like the extra indentation for no good reason and thought to remove the braces from the while loop.



async function doAjax() {
  const data = { /* stuff */ }
  const retryLimit = 2;
  let retryCount = 0;
  let found = false;

  while (!found &amp;&amp; retryCount &lt;= retryLimit) try {
    let serverResponse = await $.get("url", data);
    // Do stuff
  } catch (err) {
    retryCount++;
  }

  // Do more stuff
}




I know my team won't be against this, but I still got curious if there's a consensus or some reason in favor/against writing code this way. Thoughts?
I would not do this. It breaks too far from any typical convention for very little gain. 

I'm personally against omitting braces at all; except in very narrow circumstances. I've seen many questions on stack overflow that stem from people omitting braces and not being able to figure out why "only certain lines are running".

This also appears to look like a new language construct and feels a little jolting at first. It takes an extra second to realize what's going on.

Considering how short the lines are, indentation shouldn't be a problem; and even if it is, there are other ways of addressing that problem. I would write this in the standard way

async function doAjax() {
  const data = { /* stuff */ }
  const retryLimit = 2;
  let retryCount = 0;
  let found = false;

  while (!found &amp;&amp; retryCount &lt;= retryLimit) {
    try {
      let serverResponse = await $.get("url", data);
      // Do stuff

    } catch (err) {
      retryCount++;
    }
  }

  // Do more stuff
}


If you like playing around with making code read interestingly and creating language constructs, I recommend playing around with a language with Clojure (or another lisp). Doing experimental things with the syntax is a little more expected in a language like that.