72 karma · joined March 8, 2013
This is the general architecture of nginx for example (though it doesn't use coroutines, just callback based async io).
try {
doThing();
} catch (Exception1 e) {
handleError1();
} catch (Exception2 e) {
handleError2();
} catch (Exception3 e) {
handleError3();
}
Might be slower than Error err = doThing();
if (err.code === ERROR1) {
handleError1();
} else if (err.code === ERROR2) {
handleError2();
} else if (err.code === ERROR3) {
handleError3();
}
Exceptions are best in my mind when they are very coarsely-grained, and error-codes best when you need to handle very fine-grained errors. This is certainly true in the code ergonomics, but I'd be interested in seeing if it's true for performance as well.I'm mainly a front-end developer, and the nice thing about the npm/node ecosystem is all of your dependencies are right there in node_modules, so feel free to read them to see how they work, or why something isn't doing what you expect -- you can even add debugger statements or console.logs.
In some ecosystems this is harder because you might have to hunt for the source, or only have headers. For example in ruby, use bundle show my_dependecy to see where the code is stored.
If you want to overflow there are special types that you can use.
here's how to make that: https://www.youtube.com/watch?v=auRNHI2nkIU
You can write migrations either in plain SQL (my preferred method) or in go.