Fix error handling in dashboard actions and add errorThrown to dashboard page.

pull/10616/head
Hunter Trujillo 2017-04-25 17:12:36 -06:00
parent 116c2e3c23
commit b53c359a54
2 changed files with 8 additions and 8 deletions

View File

@ -137,9 +137,8 @@ export const getDashboardsAsync = () => async dispatch => {
const {data: {dashboards}} = await getDashboardsAJAX()
dispatch(loadDashboards(dashboards))
} catch (error) {
dispatch(errorThrown(error))
console.error(error)
throw error
dispatch(errorThrown(error))
}
}
@ -149,7 +148,7 @@ export const putDashboard = dashboard => async dispatch => {
dispatch(updateDashboard(data))
} catch (error) {
console.error(error)
// dispatch(errorThrown(error))
dispatch(errorThrown(error))
}
}
@ -189,9 +188,8 @@ export const addDashboardCellAsync = dashboard => async dispatch => {
)
dispatch(addDashboardCell(dashboard, data))
} catch (error) {
dispatch(errorThrown(error))
console.error(error)
throw error
dispatch(errorThrown(error))
}
}
@ -200,7 +198,7 @@ export const deleteDashboardCellAsync = cell => async dispatch => {
await deleteDashboardCellAJAX(cell)
dispatch(deleteDashboardCell(cell))
} catch (error) {
console.error(error)
dispatch(errorThrown(error))
throw error
}
}

View File

@ -11,6 +11,8 @@ import Dashboard from 'src/dashboards/components/Dashboard'
import TemplateVariableManager
from 'src/dashboards/components/TemplateVariableManager'
import {errorThrown as errorThrownAction} from 'shared/actions/errors'
import * as dashboardActionCreators from 'src/dashboards/actions'
import {setAutoRefresh} from 'shared/actions/app'
@ -196,7 +198,7 @@ class DashboardPage extends Component {
handleRunQueryFailure(error) {
console.error(error)
// this.props.errorThrown(error)
this.props.errorThrown(error)
}
getActiveDashboard() {
@ -383,7 +385,7 @@ const mapDispatchToProps = dispatch => ({
handleChooseAutoRefresh: bindActionCreators(setAutoRefresh, dispatch),
handleClickPresentationButton: presentationButtonDispatcher(dispatch),
dashboardActions: bindActionCreators(dashboardActionCreators, dispatch),
// errorThrown: bindActionCreators(errorThrownAction, dispatch),
errorThrown: bindActionCreators(errorThrownAction, dispatch),
})
export default connect(mapStateToProps, mapDispatchToProps)(DashboardPage)