Commit 38e6d8a1 authored by Kyle Muldoon's avatar Kyle Muldoon

removed exception folder for now, added build directory to gitignore

parent d144fbcb
HELP.md #HELP.md
.gradle #.gradle
build/ build/
!gradle/wrapper/gradle-wrapper.jar #!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/ #!**/src/main/**/build/
!**/src/test/**/build/ #!**/src/test/**/build/
#
### STS ### #### STS ###
.apt_generated #.apt_generated
.classpath #.classpath
.factorypath #.factorypath
.project #.project
.settings #.settings
.springBeans #.springBeans
.sts4-cache #.sts4-cache
bin/ #bin/
!**/src/main/**/bin/ #!**/src/main/**/bin/
!**/src/test/**/bin/ #!**/src/test/**/bin/
#
### IntelliJ IDEA ### #### IntelliJ IDEA ###
.idea #.idea
*.iws #*.iws
*.iml #*.iml
*.ipr #*.ipr
out/ #out/
!**/src/main/**/out/ #!**/src/main/**/out/
!**/src/test/**/out/ #!**/src/test/**/out/
#
### NetBeans ### #### NetBeans ###
/nbproject/private/ #/nbproject/private/
/nbbuild/ #/nbbuild/
/dist/ #/dist/
/nbdist/ #/nbdist/
/.nb-gradle/ #/.nb-gradle/
#
### VS Code ### #### VS Code ###
.vscode/ #.vscode/
package com.StudentServices.MarksService.exception;
import java.util.Date;
public class ErrorDetails {
private Date timestamp;
private String message;
private String details;
public ErrorDetails(Date timestamp, String message, String details) {
this.timestamp = timestamp;
this.message = message;
this.details = details;
}
public Date getTimestamp() {
return timestamp;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getDetails() {
return details;
}
public void setDetails(String details) {
this.details = details;
}
}
package com.StudentServices.MarksService.exception;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import java.util.Date;
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
public ResponseEntity<?> resourceNotFoundException(ResourceNotFoundException ex, WebRequest webRequest) {
com.nisum.employeeservice.exception.ErrorDetails errorDetails = new com.nisum.employeeservice.exception.ErrorDetails(new Date(), ex.getMessage(), webRequest.getDescription(false));
return new ResponseEntity<>(errorDetails, HttpStatus.NOT_FOUND);
}
}
package com.StudentServices.MarksService.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class ResourceNotFoundException extends Exception {
public ResourceNotFoundException(String message) {
super(message);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment