ember-data-url-templates
ember-data-url-templates copied to clipboard
Conflict between ember-data-url-templates and Route's error action
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.
Wow, this is interesting.
Would you be willing to create an example application with a reproduction?
@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 I don't see why it wouldn't, but I haven't tried it before.
@amiel I'll you know then! 😄
Thanks!
@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 I'm fine leaving this open for a while.
Let me know if you can find a way to replicate it.
@Aaronfischer are you still seeing this issue?
@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!