Use more descriptive exceptions in moztelemetry

NEW
Unassigned

Status

Data Platform and Tools
Telemetry APIs for Analysis
P2
normal
3 months ago
3 months ago

People

(Reporter: sunahsuh, Unassigned)

Tracking

Details

(Reporter)

Description

3 months ago
The particular issue that prompted this bug is that specifying a bad histogram name in `get_pings_properties` throws a KeyError:
  File "/mnt/anaconda2/lib/python2.7/site-packages/moztelemetry/histogram.py", line 135, in __init__
    name, histograms_definition[re.sub("^STARTUP_", "", proper_name)])
KeyError: 'NETWORK_RACE_CACHE_WITH_NETWORK_USAGE'

In this specific case, we should throw a custom exception with a better error message specifies exactly what happened ("Histogram <name> does not exist").

I'm sure there are a few other places in moztelemetry where we could provide better error messages to the end user as well.
You need to log in before you can comment on or make changes to this bug.