Merged
Conversation
4 tasks
gunjpan
suggested changes
Oct 27, 2016
Contributor
gunjpan
left a comment
There was a problem hiding this comment.
PTAL at minor comments, other than that, LGTM
lib/type-registry.js
Outdated
| typeName = typeName.toLowerCase(); | ||
|
|
||
| if (typeName === 'file') { | ||
| throw new Error('Cannot override built-in "file" type.'); |
Contributor
There was a problem hiding this comment.
@bajtos : Please change this to throw a globalized error message, for example:
if(typename === 'file'){
var eMsg = g.f('Cannot {{override}} built-in "{{file}}" type.');
throw new Error(eMsg);
}
Contributor
There was a problem hiding this comment.
Also, I don't see it being caught anywhere. So, I am assuming that it will bubble up and eventually handled. Correct?
Member
Author
There was a problem hiding this comment.
Also, I don't see it being caught anywhere. So, I am assuming that it will bubble up and eventually handled. Correct?
It will bubble up and crash the app at startup, which is my intent. Let the user know about the problem immediately at startup, rather than later when some of their requests start failing.
1b03682 to
bda97dc
Compare
Arguments of { type: 'file' } are handled specially by strong-remoting
and don't go through the usual TypeConverter path.
This causes problems in LoopBack applications with a model called
"File", which registers a type converter for "file" (the name is case
insensitive).
In this commit, we are modifying TypeRegistry to throw an error when
the caller attempts to override the built-in "file" type.
bda97dc to
2c4cc6e
Compare
Member
Author
|
@gunjpan fixed, PTAL again |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Arguments of
{ type: 'file' }are handled specially by strong-remoting and don't go through the usual TypeConverter path.This causes problems in LoopBack applications with a model called "File", which registers a type converter for "file" (the name is case insensitive).
In this patch, we are modifying TypeRegistry to throw an error when the caller attempts to override the built-in "file" type.
Connect to strongloop/loopback#2554
See also #370
@gunjpan or @deepakrkris please review
cc @fabien @ritch