File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -136,15 +136,22 @@ impl EventError {
136
136
}
137
137
}
138
138
139
+ // For convenience.
139
140
impl From < EventError > for HttpResponse {
141
+ fn from ( err : EventError ) -> HttpResponse {
142
+ ( & err) . into ( )
143
+ }
144
+ }
145
+
146
+ impl From < & EventError > for HttpResponse {
140
147
/// Build a client-facing [`HttpResponse`] appropriate for the error that occurred.
141
148
///
142
149
/// This function will set the appropriate HTTP status code (400 or 500) depending on whether the
143
150
/// error is internal (500) or caused by the client (400). For client errors, the
144
151
/// response body contains a human-readable description of the error and the `Content-Type`
145
152
/// response header is set to `text/plain`. For internal errors, no response body is returned to
146
153
/// the client.
147
- fn from ( err : EventError ) -> HttpResponse {
154
+ fn from ( err : & EventError ) -> HttpResponse {
148
155
let ( status_code, body) = match err {
149
156
// 400
150
157
EventError :: InvalidBodyJson ( err, _) => (
You can’t perform that action at this time.
0 commit comments