Bubble AJAX errors up to fetchTimeSeries
parent
a1d7933c57
commit
cd1271fde4
|
@ -52,20 +52,22 @@ const ChronoTable = React.createClass({
|
|||
}
|
||||
},
|
||||
|
||||
fetchCellData(query) {
|
||||
this.setState({isLoading: true})
|
||||
async fetchCellData(query) {
|
||||
this.setState({isLoading: true});
|
||||
// second param is db, we want to leave this blank
|
||||
fetchTimeSeries(query.host, undefined, query.text).then((resp) => {
|
||||
const cellData = _.get(resp.data, ['results', '0', 'series', '0'], false)
|
||||
try {
|
||||
const {data} = await fetchTimeSeries(query.host, undefined, query.text)
|
||||
const cellData = _.get(data, ['results', '0', 'series', '0'], false);
|
||||
|
||||
if (!cellData) {
|
||||
return this.setState({isLoading: false})
|
||||
}
|
||||
|
||||
this.setState({
|
||||
cellData,
|
||||
isLoading: false,
|
||||
})
|
||||
})
|
||||
this.setState({cellData, isLoading: false})
|
||||
} catch (error) {
|
||||
console.error(error.message)
|
||||
this.setState({error: error.message, isLoading: false})
|
||||
}
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
import {proxy} from 'utils/queryUrlGenerator'
|
||||
|
||||
export default function fetchTimeSeries(source, database, query) {
|
||||
return proxy({source, query, database})
|
||||
const fetchTimeSeries = async (source, database, query) => {
|
||||
try {
|
||||
return await proxy({source, query, database})
|
||||
} catch (error) {
|
||||
console.error('error from proxy: ', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
export default fetchTimeSeries
|
||||
|
|
|
@ -12,6 +12,7 @@ export const proxy = async ({source, query, db, rp}) => {
|
|||
},
|
||||
})
|
||||
} catch (error) {
|
||||
console.error(error) // eslint-disable-line no-console
|
||||
console.error(error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue