1 package net.avcompris.commons3.api.exception;
2
3 import javax.annotation.Nullable;
4
5 public abstract class ServiceException extends Exception {
6
7 private static final long serialVersionUID = 4710950710702281780L;
8
9 private final int httpErorCode;
10
11 @Nullable
12 private final String description;
13
14 protected ServiceException(final int httpErorCode, @Nullable final String description) {
15
16 this(httpErorCode, description, null);
17 }
18
19 protected ServiceException(final int httpErorCode, @Nullable final String description,
20 @Nullable final Throwable cause) {
21
22 super(httpErorCode + ": " + description, cause);
23
24 this.httpErorCode = httpErorCode;
25 this.description = description;
26 }
27
28 public final int getHttpErrorCode() {
29
30 return httpErorCode;
31 }
32
33 @Nullable
34 public final String getDescription() {
35
36 return description;
37 }
38 }