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

Side by Side Diff: build/android/pylib/utils/decorators.py

Issue 2835203004: Fix logdog_wrapper to not upload if logdog binary does not exist. (Closed)
Patch Set: add a one liner to exception logging Created 3 years, 8 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
« no previous file with comments | « no previous file | build/android/test_wrapper/logdog_wrapper.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2017 The Chromium Authors. All rights reserved. 1 # Copyright 2017 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 import functools 5 import functools
6 import logging 6 import logging
7 7
8 8
9 def Memoize(f): 9 def Memoize(f):
10 """Decorator to cache return values of function.""" 10 """Decorator to cache return values of function."""
(...skipping 14 matching lines...) Expand all
25 default_return_value: Value to return in the case of uncaught Exception. 25 default_return_value: Value to return in the case of uncaught Exception.
26 exception_message: Message for uncaught exceptions. 26 exception_message: Message for uncaught exceptions.
27 """ 27 """
28 def decorator(f): 28 def decorator(f):
29 @functools.wraps(f) 29 @functools.wraps(f)
30 def wrapper(*args, **kwargs): 30 def wrapper(*args, **kwargs):
31 try: 31 try:
32 return f(*args, **kwargs) 32 return f(*args, **kwargs)
33 except Exception: # pylint: disable=broad-except 33 except Exception: # pylint: disable=broad-except
34 logging.exception(exception_message) 34 logging.exception(exception_message)
35 logging.exception('The above exception is suppressed on purpose. '
jbudorick 2017/04/24 22:26:29 Could we just change the default exception_message
mikecase (-- gone --) 2017/04/24 22:33:40 Im not the biggest fan of this. If people are bein
BigBossZhiling 2017/04/25 18:13:47 Done.
36 'It won\'t cause any crash.')
35 return default_return_value 37 return default_return_value
36 return wrapper 38 return wrapper
37 return decorator 39 return decorator
OLDNEW
« no previous file with comments | « no previous file | build/android/test_wrapper/logdog_wrapper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698