21.6 When panic Is Appropriate and When to Return Errors Instead
Look, let’s get one thing straight: panic is your program screaming “I CAN’T EVEN” and noping out of existence. It’s the nuclear option. For 99% of the errors your code will encounter, you should be using the polite, dignified method of returning an error value. It’s the difference between a waiter gracefully telling you the kitchen is out of the salmon and the same waiter bursting into flames because you asked for extra lemon.