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

Side by Side Diff: client/third_party/infra_libs/ts_mon/common/errors.py

Issue 2705273003: Roll infra_libs and gae_ts_mon in luci-py, and add field_specs to all metrics (Closed)
Patch Set: Rebase Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 """Classes representing errors that can be raised by the monitoring library.""" 5 """Classes representing errors that can be raised by the monitoring library."""
6 6
7 7
8 class MonitoringError(Exception): 8 class MonitoringError(Exception):
9 """Base class for exceptions raised by this module.""" 9 """Base class for exceptions raised by this module."""
10 10
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 119
120 class UnknownModificationTypeError(MonitoringError): 120 class UnknownModificationTypeError(MonitoringError):
121 """Raised when using a Modification with an unknown type value.""" 121 """Raised when using a Modification with an unknown type value."""
122 122
123 def __init__(self, mod_type): 123 def __init__(self, mod_type):
124 self.mod_type = mod_type 124 self.mod_type = mod_type
125 125
126 def __str__(self): 126 def __str__(self):
127 return 'Unknown modification type "%s"' % self.mod_type 127 return 'Unknown modification type "%s"' % self.mod_type
128
129
130 class MetricDefinitionError(MonitoringError):
131 """Raised when a metric was defined incorrectly."""
132
133
134 class WrongFieldsError(MonitoringError):
135 """Raised when a metric is given different fields to its definition."""
136
137 def __init__(self, metric_name, got, expected):
138 self.metric_name = metric_name
139 self.got = got
140 self.expected = expected
141
142 def __str__(self):
143 return 'Metric "%s" is defined with %s fields but was given %s' % (
144 self.metric_name, self.expected, self.got)
OLDNEW
« no previous file with comments | « client/third_party/infra_libs/ts_mon/__init__.py ('k') | client/third_party/infra_libs/ts_mon/common/http_metrics.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698