Introduction
Returning errors helps your program tell when something went wrong. It lets you handle problems safely and clearly.
When a function might fail and you want to tell the caller what happened.
When reading a file that might not exist or be readable.
When dividing numbers and the divisor could be zero.
When connecting to a database that might be down.
When parsing user input that might be invalid.