Skip to content

Instantly share code, notes, and snippets.

@kalupa
Forked from tavisrudd/agenda.md
Last active September 20, 2022 20:04
Show Gist options
  • Save kalupa/05c304fa68da70ba538f73bfa64ab1d2 to your computer and use it in GitHub Desktop.
Save kalupa/05c304fa68da70ba538f73bfa64ab1d2 to your computer and use it in GitHub Desktop.
////////////////////////////////////////////////////////////////////////
// 1.1) If you saw something like this during a code review
// what would you say and how would you improve it?
// (If you don't know Typescript's type system well, pseudo-code it or talk about a typed language you know well.)
type Shape = {
type: "circle" | "square";
size: number;
radius: number;
};
////////////////////////////////////////////////////////////////////////
// 2.1) From an error handling perspective what's the difference
// between these in node.
const async1 = async () => {
try {
const resp = await fetch(url);
return resp.json();
} catch (err) {
console.error(err);
throw new Error("oops");
}
};
const async2 = async () => {
const respPromise = fetch(url);
try {
return (await respPromise).json();
} catch (err) {
console.error(err);
throw new Error("oops");
}
};
// 2.2) What else would you say about the error handling of both
// during a code review
@kalupa
Copy link
Author

kalupa commented Sep 20, 2022

eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE2NDI5OTYxMjQsInVzZXIiOnsiaWQiOiI2OGQxZjNlZi1jOWZhLTQ5MDItODQxNi0yY2FkNjg1NGU5MGQiLCJpbnRJZCI6ODM1ODgyLCJhZG1pbiI6dHJ1ZX0sImFjY291bnQiOnsiaWQiOiIxZTNhMWZiNC02NzYyLTQ4MTAtODIyYi05NzA2YzAzM2ZhNjgiLCJyb2xlcyI6WyJvd25lciJdfSwiY2xpZW50Ijp7ImlkIjoiYzk0NzJlNGUtNjNiNy00ODQzLWEzZjItNDAxZmNhMzg1Njk2IiwiaW50SWQiOjM0NDQyOTEsInJvbGVzIjpbImF1dGhvciJdfX0.ViNT-mu1T7QPFTEx_R8svu4oiL1cG4Um2CTiSVrpjhIw7aXzg-ZlqAjAMhblNL2s92wcrTLxCkhI9cVvdqylKg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment