Skip to content

Commit

Permalink
Merge pull request #3653 from nextcloud/feature/show-error-on-boad-fe…
Browse files Browse the repository at this point in the history
…tchdata

🚸 Shows error on board fetchData
  • Loading branch information
juliusknorr authored Mar 21, 2022
2 parents 6cd8173 + 2e94b8e commit 3aad014
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/board/Board.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ import Controls from '../Controls'
import Stack from './Stack'
import { EmptyContent } from '@nextcloud/vue'
import GlobalSearchResults from '../search/GlobalSearchResults'
import { showError } from '../../helpers/errors'

export default {
name: 'Board',
Expand Down Expand Up @@ -139,6 +140,7 @@ export default {
await this.$store.dispatch('loadStacks', this.id)
} catch (e) {
console.error(e)
showError(e)
}
this.loading = false
},
Expand Down
27 changes: 27 additions & 0 deletions src/helpers/errors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { showError as errorDialog } from '@nextcloud/dialogs'

const showAxiosError = err => {
const response = err?.response || {}
const message = response?.data.message

if (message) {
errorDialog(message)
return
}

errorDialog(err.message)
}

const showError = err => {
// axios error
if (err.response) {
showAxiosError(err)
return
}

errorDialog(err.message)
}

export {
showError,
}

0 comments on commit 3aad014

Please sign in to comment.