-
Notifications
You must be signed in to change notification settings - Fork 200
Expand file tree
/
Copy patherrors.rs
More file actions
169 lines (148 loc) · 3.88 KB
/
Copy patherrors.rs
File metadata and controls
169 lines (148 loc) · 3.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
use rivet_error::*;
use serde::{Deserialize, Serialize};
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"invalid_request_body",
"Unable to parse request body.",
"Unable to parse request body: {0}."
)]
pub struct InvalidRequestBody(pub String);
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"invalid_response_body",
"Unable to parse response body.",
"Unable to parse response body: {0}."
)]
pub struct InvalidResponseBody(pub String);
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"rate_limit",
"Too many requests. Try again later.",
"Too many requests to '{method} {path}' from IP {ip}."
)]
pub struct RateLimit {
pub method: String,
pub path: String,
pub ip: String,
}
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"http_request_build_failed",
"Failed to build HTTP request.",
"Failed to build HTTP request: {0}."
)]
pub struct HttpRequestBuildFailed(pub String);
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"uri_parse_error",
"URI parse error.",
"URI parse error: {0}."
)]
pub struct UriParseError(pub String);
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"request_build_error",
"Request build error.",
"Request build error: {0}."
)]
pub struct RequestBuildError(pub String);
#[derive(RivetError)]
#[error("guard", "upstream_error", "Upstream error.", "Upstream error: {0}.")]
pub struct UpstreamError(pub String);
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"request_timeout",
"Request timed out.",
"Request timed out after {timeout_seconds} seconds."
)]
pub struct RequestTimeout {
pub timeout_seconds: u64,
}
#[derive(RivetError, Serialize, Deserialize)]
#[error("guard", "no_route_targets", "No targets found.")]
pub struct NoRouteTargets;
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"retry_attempts_exceeded",
"Retry attempts exceeded.",
"All {attempts} retry attempts failed."
)]
pub struct RetryAttemptsExceeded {
pub attempts: u32,
}
#[derive(RivetError, Serialize, Deserialize)]
#[error("guard", "connection_error", "Connection error: {error_message}.")]
pub struct ConnectionError {
pub error_message: String,
pub remote_addr: String,
}
#[derive(RivetError, Serialize, Deserialize)]
#[error("guard", "service_unavailable", "Service unavailable.")]
pub struct ServiceUnavailable;
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"actor_stopped_while_waiting",
"Actor stopped while waiting for a response."
)]
pub struct ActorStoppedWhileWaiting;
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"tunnel_request_aborted",
"Actor tunnel aborted the request."
)]
pub struct TunnelRequestAborted;
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"tunnel_message_timeout",
"Actor tunnel message timed out."
)]
pub struct TunnelMessageTimeout;
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"tunnel_response_closed",
"Actor tunnel closed before sending a response."
)]
pub struct TunnelResponseClosed;
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"gateway_response_start_timeout",
"Timed out waiting for actor response start."
)]
pub struct GatewayResponseStartTimeout;
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"websocket_service_unavailable",
"WebSocket service unavailable."
)]
pub struct WebSocketServiceUnavailable;
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"websocket_service_hibernate",
"Initiate WebSocket service hibernation."
)]
pub struct WebSocketServiceHibernate;
#[derive(RivetError, Serialize, Deserialize)]
#[error("guard", "websocket_service_timeout", "WebSocket service timed out.")]
pub struct WebSocketServiceTimeout;
#[derive(RivetError, Serialize, Deserialize)]
#[error(
"guard",
"target_changed",
"WebSocket target changed, retry not possible."
)]
pub struct WebSocketTargetChanged;