Semantic satiation is a psychological phenomenon in which repetition causes a word or phrase to temporarily lose meaning for the listener, who then perceives the speech as repeated meaningless sounds. Extended inspection or analysis (staring at the word or phrase for a lengthy period of time) in place of repetition also produces the same effect.
Because if it’s a process-ending error, then by being async we ensure that the error handling function is never run, so nobody will know that the error occurred /s
It looks like now only logging is being done, but maybe it was anticipated that in the future asyncronous stuff like sending a log email to the dev team with error details would happen.
It's fine other than confusing async. There's plenty of errors that aren't really recoverable, and all you can do is log them (and have user refresh the page).
axios.get('/user/12345')
.catch(function (error) {
if (error.response) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
console.log(error.response.data);
console.log(error.response.status);
console.log(error.response.headers);
} else if (error.request) {
// The request was made but no response was received
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js
console.log(error.request);
} else {
// Something happened in setting up the request that triggered an Error
console.log('Error', error.message);
}
console.log(error.config);
});
I.e. is it an HTTP error (response|request) or a general Exception (message)
When I said take me to the moon I never meant take me alone I thought if mankind toured the sky It meant all of us could go But I don't want to see the stars if they're just One more piece of land for you to colonize For us to turn to sand
i have never heard my opinion about Elons rockets summarised better than in Rät by Penelope Scott.
Even the petrol industry is trying to switch into "green" and alternative energy. They know that their days are coming to an end, and they still have insane amounts of money to shift over into other areas.
Obviously they're still defending fossile fuels kicking and screaming since they want to continue making money off that for as long as possible, but they're not gonna disappear with them.
It's catching the error thrown by the promise. You generally don't want to throw from your own async functions since they should be designed to fail (and is a big pain point in designing async programs). If you are crashing your programs because some external API had a hiccup, you should rethink your logic. Recover from the error, make it retry, show an retry button to the user, log out, whatever is right in the context.
Nothing bad with failing, even better if it recovers but there's rarely a case where you need to exit the program, only when it's something destructive and impossible to recover from.
4
u/vardi_y Nov 09 '21
Have you thought about the amount of code going into that rocket?
104
u/brownej Nov 09 '21
"error" has lost all meaning to me
58
u/spryion Nov 09 '21
Probably too sleepy to use my brain, why is the function even marked async here?
46
u/TheUnlocked Nov 09 '21
This code is fine, just a little bit verbose and unnecessarily async.
29
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Nov 09 '21
Image Transcription: Code
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
24
u/taw Nov 09 '21
It's fine other than confusing
async. There's plenty of errors that aren't really recoverable, and all you can do is log them (and have user refresh the page).4
u/laundmo Nov 10 '21
i have never heard my opinion about Elons rockets summarised better than in Rät by Penelope Scott.
about the actual content: the fuck?
1
u/lolgeny Nov 15 '21
What tool did you use to make this?
2
u/maffoobristol Nov 10 '21
I've seen bad code, this is just "person doesn't quite get what they're doing" code. It's only scratching the surface of the horrors that can exist.
0
u/ghostwilliz Nov 09 '21
Mars is gonna be covered in exon gas stations and McDonalds
-2
u/[deleted] Nov 09 '21
I'm having a hard time believing this is real
0
u/creepy_Noire_fan Nov 09 '21
ok, wtf?
0
u/shanster925 Nov 10 '21
If error, show error.
-7
u/[deleted] Nov 09 '21
so we catch and print, yet it doesn't crash ? lmao