Hacker News new | ask | show | jobs
by 1f97 2488 days ago
can anyone tell me why he says that the axios snippet is wrong?
4 comments

You catch an error to proceed with the expected behaviour, for one.
Why use anonymous functions for control flow? Nearly any other language would either return an error or throw an exception.
Presumably because a rEaL pRoGrAmMiNg LaNgUaGe would have used different exception types to provide the same levels of distinction which still results in basically the same if/else-if/else (or try/catch/catch) structure but "more civilised".

Or because he thinks web apps don't care about whether the server couldn't be reached and whether the server rejected a request. Your guess is as good as mine.

That makes a lot more sense than my assumption (based on his next paragraph) that he just didn’t like chained ‘if’ statements. His mention of “nested ifs” threw me off tremendously, considering that code block doesn’t contain any nested ifs (chained if/else is not the same as nested ifs).
because nested ifs, I think.
Idk where he was going with that, I think he either doesn’t know what nested means or he was referencing different codez
i don't see nested ifs? from what i can tell, it checks whether the error happened in the request or in the response from the server.