Please take a moment to reflect on what you have previously learned and hope to learn by completing this Google Survey. Remember your responses will be read by your instructor to help guide future lessons.
@channel Let's do this! The Java Class will be starting in 3 minutes at (https://lambdaschool.zoom.us/j/#########) Please post questions to the Slido link at (https://app.sli.do/event/XXXXXXXX)
Today we concentrate on making our applications look like we know what we are doing! We provide better exception messages to our clients. we provide data validation so WHEN our clients send us bad data, we reject is - with a nice readable message of course! We also show data science we can work with them by learning how to get data from other APIs. So, let's make us look good!
Add fanciness to our applications
- Readable exception messages
- Data Validation
- Data from other APIs
Working with Objective: implement industry-standard exception handling including user-friendly exception messages
-
Add lines to application.properties to turn off error handling
-
The following can be treated as boilerplate code and just given students if time is an issue
- Add model
ErrorDetail
- Add model
ValidationError
- Add
handlers
subpackage - Add
HelperFunctions
-getConstraintViolation
- Add
exceptions
subpackage - Add
CustomErrorDetails
- Add
RestExceptionHandler.handleExceptionInternal
- Show exception responses
- Add
ResourceNotFoundException
- Add
ResourceFoundException
- Replace
EntityNotFoundException
withResourceNotFoundException
- Replace
EntityExistsException
withResourceFoundException
- Show exception responses
- Add model
Add file scanner code to the main application.
Note: Adding NotNull aids in exception reporting.
- In Role Model add
@NotNull
- In User model add
@NotNull
and@Size
- In Useremail model add
@NotNull
and point out@Email
- Try adding password that is too short
PATCH http://localhost:2019/users/user/15
For request body use
{
"password" : "ABC"
}
-
Add Swagger Validation dependency to POM.XML
-
Add Swagger Validation import to Swagger2Config
-
Add User model documentation
-
Add User Controller documentation
-
Adjust the amount to add based on time available
-
Add model
CountryData
-
Add Model
Currency
-
Add
ourCountryData
toHelperFunctions
-
Add
CountryDataController
- Controller to Populate Data
- Controller to Read Data
- Improving exception handling
- Validating data we get from clients
- Getting data from other APIs
- We will continue adding functionality to make a better, more professional API!
- We will add user authentication!
Please take a moment to reflect on what you have learned in today's Guided Project. Remember your response will be read by your instructor to help guide future lessons.