Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: mojo/services/network/net_adapters.cc

Issue 933973002: Return errors from the Mojo network service using an enum. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/services/network/net_adapters.h" 5 #include "mojo/services/network/net_adapters.h"
6 6
7 #include "net/base/net_errors.h" 7 #include "net/base/net_errors.h"
8 8
9 namespace mojo { 9 namespace mojo {
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 pending_buffer_(pending_buffer) { 102 pending_buffer_(pending_buffer) {
103 } 103 }
104 104
105 MojoToNetIOBuffer::~MojoToNetIOBuffer() { 105 MojoToNetIOBuffer::~MojoToNetIOBuffer() {
106 } 106 }
107 107
108 // ----------------------------------------------------------------------------- 108 // -----------------------------------------------------------------------------
109 109
110 NetworkErrorPtr MakeNetworkError(int error_code) { 110 NetworkErrorPtr MakeNetworkError(int error_code) {
111 NetworkErrorPtr error = NetworkError::New(); 111 NetworkErrorPtr error = NetworkError::New();
112 error->code = error_code; 112 error->code = static_cast<NetworkCode>(error_code);
jamesr 2015/02/18 18:43:06 can you add a set of static_assert<>s that the enu
ppi 2015/02/19 14:22:18 Neat! Done.
113 if (error_code <= 0) 113 if (error_code <= 0)
114 error->description = net::ErrorToString(error_code); 114 error->description = net::ErrorToString(error_code);
115 return error.Pass(); 115 return error.Pass();
116 } 116 }
117 117
118 } // namespace mojo 118 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698