Skip to content

Commit

Permalink
A little bit more explicit error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Nov 24, 2015
1 parent 8b0b13e commit b0f7b3c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions panoramix/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,18 @@ class PivotTableViz(BaseViz):

def query_obj(self):
d = super(PivotTableViz, self).query_obj()
if not self.form_data.get('groupby'):
groupby = self.form_data.get('groupby')
columns = self.form_data.get('columns')
metrics = self.form_data.get('metrics')
if not groupby:
raise Exception("Please choose at least one \"Group by\" field ")
if not self.form_data.get('metrics'):
if not metrics:
raise Exception("Please choose at least one metric")
if (
any(v in groupby for v in columns) or
any(v in columns for v in groupby)):
raise Exception("groupby and columns can't overlap")

d['groupby'] = list(set(d['groupby']) | set(self.form_data.get('columns')))
d['is_timeseries'] = False
d['timeseries_limit'] = None
Expand Down

0 comments on commit b0f7b3c

Please sign in to comment.