diff --git a/usermodel-exceptions-initial/pom.xml b/usermodel-exceptions-initial/pom.xml
index eedeb7e..0bd6bcc 100644
--- a/usermodel-exceptions-initial/pom.xml
+++ b/usermodel-exceptions-initial/pom.xml
@@ -5,7 +5,7 @@
org.springframework.boot
spring-boot-starter-parent
- 2.2.8.RELEASE
+ 2.2.9.RELEASE
com.lambdaschool
@@ -15,7 +15,7 @@
Demo project for Spring Boot
- 14
+ 11
diff --git a/usermodel-exceptions-initial/src/main/java/com/lambdaschool/usermodel/config/SwaggerWebMVC.java b/usermodel-exceptions-initial/src/main/java/com/lambdaschool/usermodel/config/SwaggerWebMVC.java
new file mode 100644
index 0000000..6101a78
--- /dev/null
+++ b/usermodel-exceptions-initial/src/main/java/com/lambdaschool/usermodel/config/SwaggerWebMVC.java
@@ -0,0 +1,18 @@
+package com.lambdaschool.usermodel.config;
+
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@Configuration
+public class SwaggerWebMVC implements WebMvcConfigurer {
+
+ @Override
+ public void addResourceHandlers(ResourceHandlerRegistry registry) {
+ registry.addResourceHandler("swagger-ui.html")
+ .addResourceLocations("classpath:/META-INF/resources/");
+ registry.addResourceHandler("/webjars/**")
+ .addResourceLocations("classpath:/META-INF/resources/webjars");
+ }
+}
diff --git a/usermodel-exceptions-initial/src/main/java/com/lambdaschool/usermodel/exceptions/CustomErrorDetails.java b/usermodel-exceptions-initial/src/main/java/com/lambdaschool/usermodel/exceptions/CustomErrorDetails.java
new file mode 100644
index 0000000..9570c61
--- /dev/null
+++ b/usermodel-exceptions-initial/src/main/java/com/lambdaschool/usermodel/exceptions/CustomErrorDetails.java
@@ -0,0 +1,35 @@
+package com.lambdaschool.usermodel.exceptions;
+
+import com.lambdaschool.usermodel.services.HelperFunctions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.WebRequest;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+
+@Component
+public class CustomErrorDetails extends DefaultErrorAttributes {
+
+ @Autowired
+ HelperFunctions helperFunctions;
+
+ @Override
+ public Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) {
+
+ Map errorAttributes = super.getErrorAttributes(webRequest, includeStackTrace);
+
+ Map errorDetails = new LinkedHashMap<>();
+ errorDetails.put("title", errorAttributes.get("error"));
+ errorDetails.put("status", errorAttributes.get("status"));
+ errorDetails.put("detail", errorAttributes.get("message"));
+ errorDetails.put("timestamp", errorAttributes.get("timestamp"));
+ errorDetails.put("developerMessage", "path " + errorAttributes.get("path"));
+
+ errorDetails.put("errors", helperFunctions.getConstraintViolations(this.getError(webRequest)));
+
+ return errorDetails;
+ }
+}
diff --git a/usermodel-exceptions-initial/src/main/java/com/lambdaschool/usermodel/exceptions/ResourceNotFoundException.java b/usermodel-exceptions-initial/src/main/java/com/lambdaschool/usermodel/exceptions/ResourceNotFoundException.java
new file mode 100644
index 0000000..9551d7b
--- /dev/null
+++ b/usermodel-exceptions-initial/src/main/java/com/lambdaschool/usermodel/exceptions/ResourceNotFoundException.java
@@ -0,0 +1,10 @@
+package com.lambdaschool.usermodel.exceptions;
+
+
+
+public class ResourceNotFoundException extends RuntimeException {
+
+ public ResourceNotFoundException(String message) {
+ super("Error from application " + message);
+ }
+}
diff --git a/usermodel-exceptions-initial/src/main/java/com/lambdaschool/usermodel/handlers/RestExceptionHandler.java b/usermodel-exceptions-initial/src/main/java/com/lambdaschool/usermodel/handlers/RestExceptionHandler.java
new file mode 100644
index 0000000..cb78bb0
--- /dev/null
+++ b/usermodel-exceptions-initial/src/main/java/com/lambdaschool/usermodel/handlers/RestExceptionHandler.java
@@ -0,0 +1,57 @@
+package com.lambdaschool.usermodel.handlers;
+
+import com.lambdaschool.usermodel.exceptions.ResourceNotFoundException;
+import com.lambdaschool.usermodel.models.ErrorDetail;
+import com.lambdaschool.usermodel.services.HelperFunctions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.Ordered;
+import org.springframework.core.annotation.Order;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+import org.springframework.web.context.request.WebRequest;
+import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
+
+import java.util.Date;
+
+
+@Order(Ordered.HIGHEST_PRECEDENCE)
+@RestControllerAdvice
+public class RestExceptionHandler extends ResponseEntityExceptionHandler {
+
+ @Autowired
+ HelperFunctions helperFunctions;
+
+ public RestExceptionHandler() {
+ super();
+ }
+
+ @ExceptionHandler(ResourceNotFoundException.class)
+ public ResponseEntity> handleResourceNotFoundException(ResourceNotFoundException rnfe){
+ ErrorDetail errorDetail = new ErrorDetail();
+ errorDetail.setTimestamp(new Date());
+ errorDetail.setStatus(HttpStatus.NOT_FOUND.value());
+ errorDetail.setTitle("Resource not Found");
+ errorDetail.setDetail(rnfe.getMessage());
+ errorDetail.setDeveloperMessage(rnfe.getClass().getName());
+
+ errorDetail.setErrors(helperFunctions.getConstraintViolations(rnfe));
+
+ return new ResponseEntity<>(errorDetail, null, HttpStatus.NOT_FOUND);
+ }
+ @Override
+ protected ResponseEntity