Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

feat(errorHandlingConfig): add an option not to encode stack in URL #16283

Closed

Conversation

aalmkhieber
Copy link

@aalmkhieber aalmkhieber commented Oct 16, 2017

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

Feature

What is the current behavior? (You can also link to an open issue here)

When there is an error in loading a module then all modules that are dependent will fail also in
loading. The throwed error contains the URL for each error. The URL contains encoded stack which leads sometimes to long URL.

What is the new behavior (if this is a feature change)?
Adding an option so that the generated URL contains only the erorr code which is informative enough
to find out the problem. closes #14744.

Does this PR introduce a breaking change?

Please check if the PR fulfills these requirements

Other information:

error is truncated

In Angular.js the error in loading a module will lead to a failur in loading
the dependent modules. In turn, this leads to a chain of errors in loading
those modules. For some reason, angularjs is copying the error stack and
passes it to the next error. This stack is encoded in URL error,so we end up
sometimes with so long Error URL when we have may dependent modules.
This option disables encoding the parameters in URL error:
angular.errorHandlingConfig({isUrlParameter:false});

closes angular#14744
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

1 similar comment
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@oliversalzburg
Copy link
Contributor

I'm pretty sure I have signed a CLA for our company and @aalmkhieber is one of our employees. I'm not quite sure how to resolve the CLA issue. Please advise.

@Narretz
Copy link
Contributor

Narretz commented Oct 16, 2017

As discussed, it's generally nice to have at least some context, and a bit of stack can definitely help.

So what about an option to set the stack length (not the url length)? Then you can set it to 0 when you really don't want it, but provide a sensible default to show some context at least.

@Narretz Narretz added this to the Ice Box milestone Oct 16, 2017
@aalmkhieber aalmkhieber changed the title feat(errorHandlingConfig): add an option so that the parameters of URL feat(errorHandlingConfig): add an option not to encode stack in URL Oct 19, 2017
@frederikprijck
Copy link
Contributor

frederikprijck commented Oct 19, 2017

@oliversalzburg

I'm pretty sure I have signed a CLA for our company and @aalmkhieber is one of our employees. I'm not quite sure how to resolve the CLA issue. Please advise.

I am wrong here, but afaik your company has nothing to do with this as the contribution is done by a single user, it's that particular user who needs to sign the CLA (I guess not all future contributions of him will be related to your company, right ?).

@gkalpak
Copy link
Member

gkalpak commented Oct 19, 2017

@frederikprijck, n that is not correct. Company CLAs are a thing 😃
But they might need to be manually verified.

@IgorMinar, can you confirm/verify the CLA?

@frederikprijck
Copy link
Contributor

@oliversalzburg @gkalpak Okay, ignore that part. Made (still makes) little sense to me if the commit is done using a single github account. But nvm I guess 🙈

@oliversalzburg
Copy link
Contributor

@frederikprijck It's not done using a single account. I have my own account and so does every other employee. We have signed a corporate CLA with Google, so that all our employees are allowed to contribute to AngularJS.

I neglected to add @aalmkhieber to the Google Group associated with our CLA, but I have done so in the meanwhile. At least, I think I did, as the process is not as clear as I would like it to be :D

If someone could offer some feedback on the implementation, that would be awesome.

@Narretz
Copy link
Contributor

Narretz commented Oct 19, 2017

If someone could offer some feedback on the implementation, that would be awesome.

I did, here: #16283 (comment)

@Narretz
Copy link
Contributor

Narretz commented Oct 23, 2017

I've left more info in the first thread: #15707 (comment)

@oliversalzburg
Copy link
Contributor

@aalmkhieber actually had more extensive configuration options available in a PoC. He's currently researching how to properly implement them.

@aalmkhieber Could you update us on the state of development? If there are any open questions, I'm sure someone can offer some guidance.

@aalmkhieber
Copy link
Author

I suggest that we can add two more options to error configuration to control the behaviour of loadModules function in terms of catched errors:

  • isModuleErr: specifies whether an error will be throwed for each failed module or not.
  • isStack: specifies whether the stack of a failed module will be passed to Minerr or not.

Implementing isModuleErr through just rethrowing the catched error will cause the stack to be changed in chrome:
https://bugs.chromium.org/p/chromium/issues/detail?id=60240

Please advise!

@gkalpak
Copy link
Member

gkalpak commented Oct 24, 2017

Implementing isModuleErr through just rethrowing the catched error will cause the stack to be changed in chrome

I couldn't reproduce it and that issue is closed as fixed 😕

@Narretz
Copy link
Contributor

Narretz commented Oct 24, 2017

I don't think adding even more config options is very developer friendly.
I think the main problem is really that modulerr is adding the stack to the message, which then gets passed to nomod, and so on.
So I added an option to remove the errorUrl from the message that is passed to the error: http://plnkr.co/edit/6zfFojrkH4xha9HmXodj?p=preview (flatErrors for now).
That means only the last error that is thrown contains a url.
Voila, the message is much easier to read (at least in Chrome).
And as far as I can tell, you don't lose much stack info, because the stack only points at AngularJS internals anyway.

@aalmkhieber aalmkhieber mentioned this pull request Oct 25, 2017
3 tasks
@oliversalzburg
Copy link
Contributor

@Narretz I don't get it. I complain about the error message and I'm being told "Hey, we're adding configuration capabilities. That's the way to solve this problem."

Now we're adding configuration options to that capability and suddenly it's not the way to go?

@Narretz
Copy link
Contributor

Narretz commented Oct 25, 2017

@oliversalzburg
I explained why I think those specific config options that you suggested aren't a good fit.
a) the first one is removing all context from the error url, even if it's just a short string = too aggressive
b) the second and third options are too specific. They only affect one type of error message and if they are not the default, it's imo too difficult for a dev to find out that these specific config options affect their error messages.

This is my opinion and other members might disagree, however I feel like we should discuss the options, but instead I didn't get any clear response to the points I made, which I find rather strange tbh, especially if the answer is simply "more code".

@aalmkhieber
Copy link
Author

aalmkhieber commented Oct 25, 2017

@Narretz I agree that the second and the third options are too specific but they offer us a solution to these too long messages. And I think the output of the script:
http://plnkr.co/edit/6zfFojrkH4xha9HmXodj?p=preview
is very reasonable for both the long and the information and making it as a default would be great. For the first option,I disagree because many developers read the console before clicking on the link so that they have a little bit information about the error and with the short link they can figure out the problem.

@Narretz
Copy link
Contributor

Narretz commented Oct 26, 2017

I will look into how my proposal affects other error messages, and put it up for discussion at the next team meeting. I guess an extra option to turn off all arguments doesn't hurt, either.

@aalmkhieber
Copy link
Author

@Narretz Great!

@Narretz
Copy link
Contributor

Narretz commented Nov 2, 2017

We've put this on the back burner as we are trying to get up to speed with the 1.7 release, but I think in general we'll implement it with an option to restrict the args length (so you can set it to 0, and get the plain error url)

@stevenvachon
Copy link

...

@petebacondarwin petebacondarwin self-assigned this May 14, 2018
@petebacondarwin petebacondarwin modified the milestones: Ice Box, 1.7.x May 14, 2018
Narretz pushed a commit to Narretz/angular.js that referenced this pull request Jun 6, 2018
Specific errors, such as nested module loading, can create very long
error urls because they include the error stack. These urls create visual
clutter in the browser console, are often not clickable, and may be rejected
by the docs page because they are simply too long.

We've already made improvements to the error display in angular#16283, which excludes
the error url from error parameters, which results in cleaner error messages.

Further, modern browsers restrict console message length intelligently.

This option can still be useful for older browsers like Internet Explorer, or
in general to reduce visual clutter in the console.

Closes angular#14744
Narretz pushed a commit to Narretz/angular.js that referenced this pull request Jun 6, 2018
Specific errors, such as nested module loading, can create very long
error urls because they include the error stack. These urls create visual
clutter in the browser console, are often not clickable, and may be rejected
by the docs page because they are simply too long.

We've already made improvements to the error display in angular#16283, which excludes
the error url from error parameters, which results in cleaner error messages.

Further, modern browsers restrict console message length intelligently.

This option can still be useful for older browsers like Internet Explorer, or
in general to reduce visual clutter in the console.

Closes angular#14744
Closes angular#15707
Closes angular#16283
Closes angular#16299
Narretz added a commit that referenced this pull request Jun 6, 2018
Specific errors, such as those during nested module loading, can create very long
error urls because the error message includes the error stack. These urls create visual
clutter in the browser console, are often not clickable, and may be rejected
by the docs page because they are simply too long.

We've already made improvements to the error display in #16283, which excludes
the error url from error parameters, which results in cleaner error messages.

Further, modern browsers restrict console message length intelligently.

This option can still be useful for older browsers like Internet Explorer, or
in general to reduce visual clutter in the console.

Closes #14744
Closes #15707
Closes #16283
Closes #16299 
Closes #16591
Narretz added a commit that referenced this pull request Jun 6, 2018
Specific errors, such as those during nested module loading, can create very long
error urls because the error message includes the error stack. These urls create visual
clutter in the browser console, are often not clickable, and may be rejected
by the docs page because they are simply too long.

We've already made improvements to the error display in #16283, which excludes
the error url from error parameters, which results in cleaner error messages.

Further, modern browsers restrict console message length intelligently.

This option can still be useful for older browsers like Internet Explorer, or
in general to reduce visual clutter in the console.

Closes #14744
Closes #15707
Closes #16283
Closes #16299 
Closes #16591
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Get rid of huge error messages
8 participants