mirror of
https://github.com/apache/superset.git
synced 2024-09-12 08:39:45 -04:00
Some more error handling when rendering the explore view (#361)
This commit is contained in:
parent
01c2c7baf8
commit
04d769ff24
@ -112,11 +112,13 @@ class FormFactory(object):
|
||||
from caravel.viz import viz_types
|
||||
viz = self.viz
|
||||
datasource = viz.datasource
|
||||
if not datasource.metrics_combo:
|
||||
raise Exception("Please define at least one metric for your table")
|
||||
default_metric = datasource.metrics_combo[0][0]
|
||||
|
||||
gb_cols = datasource.groupby_column_names
|
||||
default_groupby = gb_cols[0] if gb_cols else None
|
||||
group_by_choices = [(s, s) for s in datasource.groupby_column_names]
|
||||
group_by_choices = self.choicify(gb_cols)
|
||||
# Pool of all the fields that can be used in Caravel
|
||||
self.field_dict = {
|
||||
'viz_type': SelectField(
|
||||
|
@ -490,10 +490,14 @@ class Caravel(BaseView):
|
||||
return redirect(datasource.default_endpoint)
|
||||
if not viz_type:
|
||||
viz_type = "table"
|
||||
obj = viz.viz_types[viz_type](
|
||||
datasource,
|
||||
form_data=request.args,
|
||||
slice_=slc)
|
||||
try:
|
||||
obj = viz.viz_types[viz_type](
|
||||
datasource,
|
||||
form_data=request.args,
|
||||
slice_=slc)
|
||||
except Exception as e:
|
||||
flash(str(e), "danger")
|
||||
return redirect(error_redirect)
|
||||
if request.args.get("json") == "true":
|
||||
status = 200
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user