Комментарии:
.... monad
Ответитьtoday we discover lua multiple returns
ОтветитьBig brain
ОтветитьOkay this is the most useful video i e watched today ❤
ОтветитьNot a developer. Don't know JavaScript. But I a saw a short earlier about the same topic and the guy used Promise.allSettled() approach with a single try catch.
ОтветитьDon’t use prettier
ОтветитьReactive programming introduction
ОтветитьLiterally Go, just switch to Go in this case.
ОтветитьI recommended: await-to-js
ОтветитьNever have a bug in your code with one simple move: wrap the whole program in a try catch.
ОтветитьThen people laugh a error handling in Go 😂😂😂
ОтветитьWhy don't you just wrap all await statements together with a single try-catch then handle accordingly by the caught error's type?
ОтветитьBest solution to the problem is to use js-awe library
ОтветитьGuys you all get trapped. He knows hes talking bs, but he knows a lot of us cant stand to not name and it as such and comment.
ОтветитьBro just invented the Result type
ОтветитьHow are the if statements better than the try/catch blocks?
ОтветитьThat... Literally just moves the .Catch() somewhere else, forces you to use tuples and still requires you to process the errors if you need to return anything meaningful
ОтветитьEither monad
ОтветитьOr just use go.
ОтветитьI forgot how bad try catch in java/typescript is, make me appreciate ".await?" in rust a thousand times more
ОтветитьJust break promise functions out…
ОтветитьThere is no need to return array only to destructure it later. Just return Error and then use if (result instanceof Error) { ... } instead. If you need to handle some errors elssewhere then extend the Error type and use your custom types then. It's javascript, not a golang, no need to invent something not needed.
Ответитьwow
ОтветитьYou're basically just writing Go code then
ОтветитьRust.
ОтветитьSo you're telling me that it's basically Rust?
ОтветитьBetter a few try-catches one by one rather than nested...
ОтветитьJust use express-async-handler < to not to write some many code.
Ответитьor do await Promise.all([promise1(), promise2()])
ОтветитьRight, JS doesn't bubble up errors from functions. Would have made this a lot easier.
ОтветитьI fuckin needed this holy shit. Tysm
Ответитьwhat about just use 1 await and all data is called in a callback function or function after success
ОтветитьOr use Either from fp-ts
ОтветитьCan't you put all awaits in one try catch
ОтветитьThis is golang style.
ОтветитьIt feels sort of like an Either monad. Awesome tip. Thanks
ОтветитьDestructuring the tuple is not typescript-friendly, normally I would wrap data and error into an obj.
ОтветитьOr called as the Either monad in FP convention
Ответитьjust use golang at this point
Ответитьthis case Promise.all is better
ОтветитьHow to create rust from scratch:
ОтветитьYou just re-invented golang(go). if err !=null
ОтветитьSo, callbacks (with params (data, error)) to promises to async-await to error handling functions (that return [data, error], which we will then process with a pyramid of if-else's). How much time until we revert to callbacks?
ОтветитьBro even invented monad
ОтветитьHow to engineer js to golang
ОтветитьLets write golang in js
ОтветитьAlmost starts to look like elixir error handling
Ответитьi seriously do not understand why go style error handling has become so popular its objectively bug prone and inefficient
ОтветитьA Monad?? Correct me if I am wrong.
ОтветитьThis is literally what Golang does lol
Ответить