Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
aaronfischer opened this issue Jan 17, 2017 · 9 comments
Open

Comments

@aaronfischer
Copy link

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.

@amiel
Copy link
Owner

amiel commented Jan 17, 2017

Wow, this is interesting.

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

@aaronfischer
Copy link
Author

@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)?

@amiel
Copy link
Owner

amiel commented Jan 17, 2017

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

@aaronfischer
Copy link
Author

@amiel I'll you know then! 😄

@amiel
Copy link
Owner

amiel commented Jan 17, 2017

Thanks!

@aaronfischer
Copy link
Author

@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.

@amiel
Copy link
Owner

amiel commented Jan 18, 2017

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

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

@amiel
Copy link
Owner

amiel commented Apr 27, 2017

@aaronfischer are you still seeing this issue?

@aaronfischer
Copy link
Author

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants