diff options
| author | taehoon <th.dev91@gmail.com> | 2019-02-26 12:26:04 -0500 |
|---|---|---|
| committer | taehoon <th.dev91@gmail.com> | 2019-02-26 12:26:04 -0500 |
| commit | b78227456ea6b1a80cd85988d3ef91cb654a881c (patch) | |
| tree | 602ae896a74fb55a0a7ed6ebd14413a60809e53a /src/components/user_profile/user_profile.js | |
| parent | e687b58091bcedb6f3a56d94030fa312e51830d5 (diff) | |
Better error handling
Diffstat (limited to 'src/components/user_profile/user_profile.js')
| -rw-r--r-- | src/components/user_profile/user_profile.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index 44192e9a..ebf6c61a 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -1,3 +1,4 @@ +import get from 'lodash/get' import UserCardContent from '../user_card_content/user_card_content.vue' import UserCard from '../user_card/user_card.vue' import Timeline from '../timeline/timeline.vue' @@ -18,8 +19,15 @@ const UserProfile = { this.startFetchFavorites() if (!this.user.id) { this.$store.dispatch('fetchUser', this.fetchBy) - .catch(() => { - this.error = true + .catch((reason) => { + const errorMessage = get(reason, 'error.error') + if (errorMessage === 'No user with such user_id') { // Known error + this.error = this.$t('user_profile.profile_does_not_exist') + } else if (errorMessage) { + this.error = errorMessage + } else { + this.error = this.$t('user_profile.profile_loading_error') + } }) } }, |
