Skip to content

Handle a native angular minErr by deconstructing it #407

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

Merged
merged 3 commits into from
Nov 6, 2015

Conversation

mattrobenolt
Copy link
Contributor

Fixes GH-243

See: https://github.com/angular/angular.js/blob/v1.4.7/src/minErr.js

One thing to note, since I'm not entirely sure what we should do, is what the value inside [..] means.

[ngPattern:noregexp] would stand for ngPattern module, then noregexp is the type. As seen in https://github.com/angular/angular.js/blob/d077966ff1ac18262f4615ff1a533db24d4432a7/src/ng/directive/validators.js#L37-L40

So what I'm doing is completely clobbering stackInfo.name with this ngPattern:noregexp value, which hides the actual Error constructor type. Though, scrubbing the entire codebase of Angular, it doesn't appear that anyone leverages anything other than the default Error. But in theory, this API exists: minErr('$foo', TypeError) and what I'm doing would clobber the fact that it was a TypeError.

@mattrobenolt
Copy link
Contributor Author

I'm just going to leave this here since we'd much prefer to do this inside the angular plugin, but there's not a good enough hook to do it right yet.

stackInfo.message = matches[2];
// auto set a new tag specifically for the angular error url
options = options || {};
options.tags = objectMerge({ref: matches[3]}, options.tags);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have been extra, not tags, just for future reference.

@mattrobenolt mattrobenolt force-pushed the angular-eror branch 2 times, most recently from 885da17 to 5db0c72 Compare November 4, 2015 19:53
@mattrobenolt
Copy link
Contributor Author

@benvinegar Wanna take another look now?

@mattrobenolt mattrobenolt added this to the 1.3 milestone Nov 6, 2015
mattrobenolt added a commit that referenced this pull request Nov 6, 2015
Handle a native angular minErr by deconstructing it
@mattrobenolt mattrobenolt merged commit 768fdca into master Nov 6, 2015
@mattrobenolt mattrobenolt deleted the angular-eror branch November 6, 2015 22:11
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

Successfully merging this pull request may close these issues.

1 participant