Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 """Common functions and Exceptions for remote_device_*""" | 5 """Common functions and Exceptions for remote_device_*""" |
| 6 | 6 |
| 7 import logging | |
| 7 | 8 |
| 8 class RemoteDeviceError(Exception): | 9 class RemoteDeviceError(Exception): |
| 9 """Exception to throw when problems occur with remote device service.""" | 10 """Exception to throw when problems occur with remote device service.""" |
| 10 pass | 11 pass |
| 11 | 12 |
| 12 | 13 |
| 13 def TestHttpResponse(response, error_msg): | 14 def TestHttpResponse(response, error_msg): |
| 14 """Checks the Http response from remote device service. | 15 """Checks the Http response from remote device service. |
| 15 | 16 |
| 16 Args: | 17 Args: |
| 17 response: response dict from the remote device service. | 18 response: response dict from the remote device service. |
| 18 error_msg: Error message to display if bad response is seen. | 19 error_msg: Error message to display if bad response is seen. |
| 19 """ | 20 """ |
| 20 if response.status_code != 200: | 21 if response.status_code != 200: |
| 21 raise RemoteDeviceError(error_msg) | 22 raise RemoteDeviceError(error_msg) |
| 23 | |
| 24 | |
| 25 def SetLogging(verbose_count, level): | |
| 26 if verbose_count < 2: | |
| 27 logging.disable(level) | |
|
jbudorick
2015/01/05 16:52:29
I'm concerned with how this interacts with threadi
rnephew (Wrong account)
2015/01/05 19:31:54
Added warning comment for now. A better solution w
| |
| OLD | NEW |