Advertisement
Domy131097

Untitled

Jan 11th, 2019
100
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package hr.atos.praksa.project01.businesslogic;
  2.  
  3. public class BackendException extends RuntimeException {
  4.  
  5. private static final long serialVersionUID = -8460356990632230194L;
  6.  
  7. private final ErrorCode code;
  8.  
  9. public BackendException(ErrorCode code) {
  10. super();
  11. this.code = code;
  12. }
  13.  
  14. public BackendException(String message, Throwable cause, ErrorCode code) {
  15. super(message, cause);
  16. this.code = code;
  17. }
  18.  
  19. public BackendException(String message, ErrorCode code) {
  20. super(message);
  21. this.code = code;
  22. }
  23.  
  24. public BackendException(Throwable cause, ErrorCode code) {
  25. super(cause);
  26. this.code = code;
  27. }
  28.  
  29. public ErrorCode getCode() {
  30. return this.code;
  31. }
  32. }
  33.  
  34. package hr.atos.praksa.project01.businesslogic;
  35.  
  36. public enum ErrorCode {
  37. VALIDATION_PARSE_ERROR(422);
  38.  
  39. private int code;
  40.  
  41. ErrorCode(int code) {
  42. this.code = code;
  43. }
  44.  
  45. public int getCode() {
  46. return code;
  47. }
  48. }
Advertisement
RAW Paste Data Copied
Advertisement