diff --git a/chess/4-database/database.md b/chess/4-database/database.md index 10dc0a41..c8bdde08 100644 --- a/chess/4-database/database.md +++ b/chess/4-database/database.md @@ -76,6 +76,10 @@ boolean verifyUser(String username, String providedClearTextPassword) { The above code demonstrates the necessary concepts to implement secure password storage, but it will need to be adapted to your particular implementation. You do not need to create a different table to store your passwords. The hashed password may be stored along with your other user information in your `user` table. +## Error Handling + +Now that your database is stored in MySQL, you must account for any errors trying to connect to that program. If any exception is thrown while an endpoint is trying to access the database, this should be considered an `Internal Server Error`, and an appropriate response must be handled. The status code must be set to `500` and the body of each of these responses must include a reasonable, relevant error message. You may recall this specification from [Phase 3](../3-web-api/web-api.md#endpoint-specifications). + ## ChessGame Serialization/Deserialization The easiest way to store the state of a ChessGame in MySQL is to serialize it to a JSON string, and then store the string in your database. Whenever your server needs to update the state of a game, it should: