diff --git a/schools/javadocs/com/lambdaschool/zoos/services/ZooServiceImpl.html b/schools/javadocs/com/lambdaschool/zoos/services/ZooServiceImpl.html
index 10bef294..845a2d71 100644
--- a/schools/javadocs/com/lambdaschool/zoos/services/ZooServiceImpl.html
+++ b/schools/javadocs/com/lambdaschool/zoos/services/ZooServiceImpl.html
@@ -376,7 +376,7 @@
update
delete
@Transactional
public void delete(long id)
- throws javax.persistence.EntityNotFoundException
+ throws javax.persistence.ResourceNotFoundException
Deletes the course record, it student course combinations, and its telephone items from the database based off of the provided primary key
@@ -385,7 +385,7 @@ delete
- Parameters:
id - id The primary key (long) of the course you seek.
- Throws:
-javax.persistence.EntityNotFoundException
+javax.persistence.ResourceNotFoundException
@@ -438,7 +438,7 @@ saveZooAnimalCombo
findZooByLikeName
public java.util.ArrayList<Zoo> findZooByLikeName(java.lang.String name)
- throws javax.persistence.EntityNotFoundException
+ throws javax.persistence.ResourceNotFoundException
A list of all zoos whose name contains the given substring
A Stretch Goal
@@ -450,7 +450,7 @@ findZooByLikeName
Returns:
List of zoos whose name contains the given substring
Throws:
-javax.persistence.EntityNotFoundException
+javax.persistence.ResourceNotFoundException
diff --git a/schools/src/main/java/com/lambdaschool/schools/exceptions/CustomErrorDetails.java b/schools/src/main/java/com/lambdaschool/schools/exceptions/CustomErrorDetails.java
new file mode 100644
index 00000000..d363ce08
--- /dev/null
+++ b/schools/src/main/java/com/lambdaschool/schools/exceptions/CustomErrorDetails.java
@@ -0,0 +1,34 @@
+package com.lambdaschool.schools.exceptions;
+
+import com.lambdaschool.schools.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.Date;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+@Component
+public class CustomErrorDetails extends DefaultErrorAttributes {
+ @Autowired
+ private HelperFunctions helperFunctions;
+
+ @Override
+ public Map getErrorAttributes(WebRequest webRequest, boolean includeStackTrace) {
+ Map errorAttributes = super.getErrorAttributes(webRequest, includeStackTrace);
+
+ Map rtnAttributes = new LinkedHashMap<>();
+
+ rtnAttributes.put("title", errorAttributes.get("error"));
+ rtnAttributes.put("status", errorAttributes.get("status"));
+ rtnAttributes.put("detail", errorAttributes.get("message"));
+ rtnAttributes.put("timestamp", new Date());
+ rtnAttributes.put("developerMessage", "path: " + errorAttributes.get("path"));
+
+ rtnAttributes.put("errors", helperFunctions.getValidationErrors(this.getError(webRequest)));
+
+ return rtnAttributes;
+ }
+}
diff --git a/schools/src/main/java/com/lambdaschool/schools/exceptions/ResourceFoundException.java b/schools/src/main/java/com/lambdaschool/schools/exceptions/ResourceFoundException.java
new file mode 100644
index 00000000..082c71cc
--- /dev/null
+++ b/schools/src/main/java/com/lambdaschool/schools/exceptions/ResourceFoundException.java
@@ -0,0 +1,7 @@
+package com.lambdaschool.schools.exceptions;
+
+public class ResourceFoundException extends RuntimeException{
+ public ResourceFoundException(String message) {
+ super("Found an issue with School: " + message);
+ }
+}
diff --git a/schools/src/main/java/com/lambdaschool/schools/exceptions/ResourceNotFoundException.java b/schools/src/main/java/com/lambdaschool/schools/exceptions/ResourceNotFoundException.java
new file mode 100644
index 00000000..6d59442f
--- /dev/null
+++ b/schools/src/main/java/com/lambdaschool/schools/exceptions/ResourceNotFoundException.java
@@ -0,0 +1,8 @@
+package com.lambdaschool.schools.exceptions;
+
+
+public class ResourceNotFoundException extends RuntimeException{
+ public ResourceNotFoundException(String message) {
+ super("Found an error with School: " + message);
+ }
+}
diff --git a/schools/src/main/java/com/lambdaschool/schools/handlers/RestExceptionHandler.java b/schools/src/main/java/com/lambdaschool/schools/handlers/RestExceptionHandler.java
new file mode 100644
index 00000000..e296e2ed
--- /dev/null
+++ b/schools/src/main/java/com/lambdaschool/schools/handlers/RestExceptionHandler.java
@@ -0,0 +1,74 @@
+package com.lambdaschool.schools.handlers;
+
+import com.lambdaschool.schools.exceptions.ResourceFoundException;
+import com.lambdaschool.schools.exceptions.ResourceNotFoundException;
+import com.lambdaschool.schools.models.ErrorDetail;
+import com.lambdaschool.schools.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.MissingPathVariableException;
+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.NoHandlerFoundException;
+import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
+
+import java.util.Date;
+
+@RestControllerAdvice
+@Order(Ordered.HIGHEST_PRECEDENCE)
+public class RestExceptionHandler extends ResponseEntityExceptionHandler {
+ @Autowired
+ private HelperFunctions helperFunctions;
+
+ public RestExceptionHandler() {
+ super();
+ }
+
+ @Override
+ protected ResponseEntity