1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.linecorp.centraldogma.common;
17
18 import static java.util.Objects.requireNonNull;
19
20 import javax.annotation.Nullable;
21
22
23
24
25
26 public class TooManyRequestsException extends CentralDogmaException {
27
28 private static final long serialVersionUID = 1712601138432866984L;
29
30 @Nullable
31 private String type;
32
33
34
35
36 public TooManyRequestsException() {}
37
38
39
40
41 public TooManyRequestsException(String type, String path, double permitsPerSecond) {
42 this('\'' + path + "' (quota limit: " + permitsPerSecond + "/sec)");
43 this.type = requireNonNull(type, "type");
44 }
45
46
47
48
49 public TooManyRequestsException(String message) {
50 super(message);
51 }
52
53
54
55
56 public TooManyRequestsException(Throwable cause) {
57 super(cause);
58 }
59
60
61
62
63 public TooManyRequestsException(String message, Throwable cause) {
64 super(message, cause);
65 }
66
67
68
69
70
71
72
73 public TooManyRequestsException(String message, boolean writableStackTrace) {
74 super(message, writableStackTrace);
75 }
76
77
78
79
80 protected TooManyRequestsException(String message, Throwable cause, boolean enableSuppression,
81 boolean writableStackTrace) {
82 super(message, cause, enableSuppression, writableStackTrace);
83 }
84
85
86
87
88 @Nullable
89 public String type() {
90 return type;
91 }
92 }
93