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 {
136136 }
137137}
138138
139+ // For convenience.
139140impl From < EventError > for HttpResponse {
141+ fn from ( err : EventError ) -> HttpResponse {
142+ ( & err) . into ( )
143+ }
144+ }
145+
146+ impl From < & EventError > for HttpResponse {
140147 /// Build a client-facing [`HttpResponse`] appropriate for the error that occurred.
141148 ///
142149 /// This function will set the appropriate HTTP status code (400 or 500) depending on whether the
143150 /// error is internal (500) or caused by the client (400). For client errors, the
144151 /// response body contains a human-readable description of the error and the `Content-Type`
145152 /// response header is set to `text/plain`. For internal errors, no response body is returned to
146153 /// the client.
147- fn from ( err : EventError ) -> HttpResponse {
154+ fn from ( err : & EventError ) -> HttpResponse {
148155 let ( status_code, body) = match err {
149156 // 400
150157 EventError :: InvalidBodyJson ( err, _) => (
You can’t perform that action at this time.
0 commit comments