ember-data-url-templates icon indicating copy to clipboard operation
ember-data-url-templates copied to clipboard

Conflict between ember-data-url-templates and Route's error action

Open aaronfischer opened this issue 8 years ago • 9 comments

I'm running into an issue where the Route's error event/action is not triggered when using this addon. (http://emberjs.com/api/classes/Ember.Route.html#event_error)

// Index Route
import Ember from 'ember';

export default Ember.Route.extend({
  ...
  actions: {
    error(error) {
      console.log('APPLICATION ERROR');
      this._super(...arguments);
      console.log('ERROR', error);
      if (error.status === '404') {
        this.transitionTo('not-found');
      }
    },
  },
});
// Application Adapter
import DS from 'ember-data';
import UrlTemplates from 'ember-data-url-templates';

export default DS.JSONAPIAdapter.extend(UrlTemplates, {
  host: '',
  namespace: 'v1/foo',

  urlTemplate: '{+host}/{+namespace}/{pathForType}{/id}{?query*}',
});

With the above setup the error action is never triggered so I'm unable to write custom error handling.

aaronfischer avatar Jan 17 '17 18:01 aaronfischer

Wow, this is interesting.

Would you be willing to create an example application with a reproduction?

amiel avatar Jan 17 '17 18:01 amiel

@amiel Sure, I can probably whip up something this evening. Any ideas if ember-twiddle works with your addon (I know it can be a bit picky)?

aaronfischer avatar Jan 17 '17 18:01 aaronfischer

@Aaronfischer I don't see why it wouldn't, but I haven't tried it before.

amiel avatar Jan 17 '17 18:01 amiel

@amiel I'll you know then! 😄

aaronfischer avatar Jan 17 '17 18:01 aaronfischer

Thanks!

amiel avatar Jan 17 '17 18:01 amiel

@amiel Hmm, its passing my initial attempt to find the conflict: https://ember-twiddle.com/c82a4fb0394ab9aae996115f1d6197bc Lets keep this issue open a bit longer. Strange that on my end when I removed the UrlTemplates import it cleared up but in this twiddle its working fine. I can see the application route's error event bubbling.

aaronfischer avatar Jan 18 '17 14:01 aaronfischer

@Aaronfischer I'm fine leaving this open for a while.

Let me know if you can find a way to replicate it.

amiel avatar Jan 18 '17 16:01 amiel

@Aaronfischer are you still seeing this issue?

amiel avatar Apr 27 '17 20:04 amiel

@amiel I am (well was), however, with this particular project we ended up not needing ember-data-url-templates. So I'm no longer in a position to provide any additional details on how to replicate.

😞 Sorry!

aaronfischer avatar Apr 27 '17 20:04 aaronfischer