Handle simple error thrown by js

This commit is contained in:
Bubka 2020-01-23 17:05:24 +01:00
parent 8bfd812c70
commit 326866e1c7

View File

@ -19,9 +19,9 @@
<p>{{ $t('errors.error_occured') }}</p> <p>{{ $t('errors.error_occured') }}</p>
<p v-if="error" class="has-text-grey-lighter">{{ error.statusText }}</p> <p v-if="error" class="has-text-grey-lighter">{{ error.statusText }}</p>
<p>{{ $t('errors.please') }}<router-link :to="{ name: 'accounts' }" class="is-text has-text-grey-light">{{ $t('errors.refresh') }}</router-link></p> <p>{{ $t('errors.please') }}<router-link :to="{ name: 'accounts' }" class="is-text has-text-grey-light">{{ $t('errors.refresh') }}</router-link></p>
<p v-if="debugMode == 'development' && error.data"> <p v-if="debugMode == 'development' && error">
<strong>{{ error.data.message }}</strong><br> <strong>{{ error.message }}</strong><br>
{{ error.data.debug }} {{ error.debug }}
</p> </p>
</div> </div>
</modal> </modal>
@ -40,12 +40,30 @@
}, },
computed: { computed: {
debugMode: function() { debugMode: function() {
return process.env.NODE_ENV return process.env.NODE_ENV
}, },
error: function() { error: function() {
return this.err === undefined ? {} : this.err if( this.err === undefined ) {
return null
}
else
{
if(this.err.data) {
return this.err.data
}
else
{
return {
statusText: this.err
}
}
}
} }
}, },
props: ['err'], // error.response props: ['err'], // error.response