github.com/outbrain/consul@v1.4.5/ui-v2/app/mixins/intention/with-actions.js (about)

     1  import Mixin from '@ember/object/mixin';
     2  import WithBlockingActions from 'consul-ui/mixins/with-blocking-actions';
     3  
     4  import { INTERNAL_SERVER_ERROR as HTTP_INTERNAL_SERVER_ERROR } from 'consul-ui/utils/http/status';
     5  export default Mixin.create(WithBlockingActions, {
     6    errorCreate: function(type, e) {
     7      if (e && e.errors && e.errors[0]) {
     8        const error = e.errors[0];
     9        if (parseInt(error.status) === HTTP_INTERNAL_SERVER_ERROR) {
    10          if (error.detail.indexOf('duplicate intention found:') === 0) {
    11            return 'exists';
    12          }
    13        }
    14      }
    15      return type;
    16    },
    17  });