-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Configuring a route with "redirect" property causes BlueBird warnings #480
Comments
The same warning is thrown for: config.mapUnknownRoutes({ redirect:'home'}); is there any way to suppress it ? |
If you don't want these to show then you need to disable them in your bluebird config: If you're using Aurelia CLI you can change it within the main.js file.
|
@jagonalez I'm aware of this, thanks This "silence all warnings" flag isn't the solution, by disabling ALL warnings (for the issue mentioned above) I might be losing out on other warnings that it may be trying to warn me about |
@ry8806 I agree - it's not ideal. In our app we're using environment variables to turn on warnings only for debugging. Looking at the w3 specification Promise.reject should return an Error object: The w3 specification for Promises recommends that reject return an instance of Error. https://www.w3.org/2001/tag/doc/promises-guide#reasons-should-be-errors
Bluebird's docs explain why:
The only way to stop the console warnings is to change the code to return an Error or not use Promise.reject for redirection. @EisenbergEffect - What are your thoughts? |
Updates on this? This has been bugging me for a while now. Is there really nothing else we can do except disable all warnings? |
I get why the warning is thrown, and valid, but I don't see why we'd reject a promise to do a redirect. If we HAVE to use promise rejection, couldnt this issue be solved by inheriting redirects from Error? Or adding the needed property stubs (.stack and .message) to the redirect class? |
I get this is a low profile issue but could we get an official response on whether we should expect this to be handled or if the only workaround is to disable warning? |
I'm now hitting this problem, and would like to know if there's any status change on how to fix it? |
@Kukks for the record, the problem is just a warning being logged to the console? I think a good, viable long term fix would be to allow resolving a redirect as well. I agree that while the reject notation half makes sense, it half doesn't. PRs welcome if someone wants to take a stab at that. |
@davismj I've been digging into the router recently and noticed a few places where promises aren't being returned from one internal method to the next. One example in the Another one is So what happens to the promise that's returned by I can't help but wonder if this is intended for some kind of asynchrony, or if this was overlooked at some point? I'm fairly sure that this sort of thing is what causes the promise warnings. |
@fkleuver as I didn't write the code and there aren't a lot of comments, I can't say for sure whether or not the highly async architecture was the right way to go. I've noticed the same things and they seem like a liability to me as well, but they're (a) deep and (b) pervasive, so I'm not in any place to start messing with them. That said, as far as I understand, this particular issue is caused when aurelia internals reject() |
Can we change this? Or just keep in mind for vNext? |
As davismj pointed out, it seems my earlier comment isn't applicable to this specific issue. I'd go with his suggestion to allow redirects to be resolved as being the point of action here. I might take a stab at it if no one else is working on it. Could you double check as you're the one who's on top of the issues? :) |
I remember too.. there were an issue where a question was asked.. |
Technically it's an uncaught error, and that's certainly not a good thing. |
Technically-shmecnically |
@fkleuver No one is working on it as far as I know. |
The fix introduced in 487c33d causes a much more serious error when redirecting in a sub-router config: |
This causes aurelia#480 to re-appear until a better handling for cancellations exists
I concur with @rluba , after doing a "clean" install this morning referencing |
Same boat, broke our prodcution builds since we get rid of package lock
json file due to other weird crazy errors from aurelia when we leave it in
…On Tue, Jun 19, 2018 at 10:37 AM Stefan Buys ***@***.***> wrote:
I concur with @rluba <https://github.com/rluba> , after doing a "clean"
install this morning referencing ***@***.*** (since Feb
2018), I got ***@***.***, which is causing the TypeError: Cannot
read property 'childRouter' of undefined error. Manually installing
***@***.*** fixed it though.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#480 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABu-_mjzjdrVBxsMedsiu28RsF3Guo-xks5t-Lg0gaJpZM4MjrVJ>
.
|
Yep agreed, #603 should be merged asap. Sorry for breaking your apps! |
It'll be getting released today. |
Shouldn't this be reopened since #597 was reverted? |
I'm submitting a bug report
1.0.1
Please tell us about your environment:
Operating System:
Windows 10
Browser:
all
Language:
all
Current behavior:
specifying "redirect" property in a route configuration, causes BlueBird warnings about "Warning: a promise was rejected with a non-error: [object Object]"
This comes from the router method:
I tired creating a gist given the link in the Issue Template, however i can't replicate it in a Gist - i'm assuming the bluebird promises library isn't included in gists?
Expected/desired behavior:
Not to create a warning in the console everytime that specific route is redirected
Less warnings in the console
I understand that this is a BlueBird "quirk", however I'm posing the question as to whether Aurelia adjusts its use of BlueBird to stop these warnings? or if we need to go to BlueBird and propose a "don't warn me when a promise is rejected with a non-error" flag?
The text was updated successfully, but these errors were encountered: