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

removed exception folder for now, added build directory to gitignore

parent d144fbcb
HELP.md
.gradle
#HELP.md
#.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
#!gradle/wrapper/gradle-wrapper.jar
#!**/src/main/**/build/
#!**/src/test/**/build/
#
#### STS ###
#.apt_generated
#.classpath
#.factorypath
#.project
#.settings
#.springBeans
#.sts4-cache
#bin/
#!**/src/main/**/bin/
#!**/src/test/**/bin/
#
#### IntelliJ IDEA ###
#.idea
#*.iws
#*.iml
#*.ipr
#out/
#!**/src/main/**/out/
#!**/src/test/**/out/
#
#### NetBeans ###
#/nbproject/private/
#/nbbuild/
#/dist/
#/nbdist/
#/.nb-gradle/
#
#### VS Code ###
#.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