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
Fix EZP-21666: refactor PromiseCAPI and PromiseService classes #24
Conversation
jshint with our configuration reports the following issues:
|
smallish cookbook fixes
Silencing q false positive warning on rejection handling, CS cookbook fixes
* | ||
* @method generatePromiseService | ||
* @param serviceFactory {function} function which returns one of the CAPI services | ||
* @method getPromiseService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_getPromiseService
and it should be marked as protected
Workaround as opposed to what? Without this option Q library is throwing mentioned warnings whenever we are handling rejection cases (e.g. in real life - any error of any service). |
as opposed to:
And if it turns out that we really need to call this, please add this in a dedicated issue/commit with a proper commit log and with a proper inline comment because:
|
and can you please create a gist with a valid code that allows to get this warning. |
Both points are exactly what I have done before this fix. But, indeed, it should be done in more "systematic" way. Should those gists be "executable"? Or just give a straight vision of the problem, like these 2: This code does NOT throw the warning: https://gist.github.com/wiseman17/7356346 It will take more time to make "executable" versions, but I can do that as well. |
yeah, I'm more interested in a real usage of the REST client than in a excerpt of the unit tests. |
Here is the "real life" one: https://gist.github.com/wiseman17/7369604 Took some time, as it turned out that at least on Win7 the Chrome is NOT throwing this warning, but FF and IE do throw it all right :). |
Fixes according to review
Mentioned issues are fixed. |
so I guess, the double name declaration of the method name is not needed anymore ( |
That's true. Should I fix it in this on in a separate issue? |
Since that's related to a change done in this PR, that should definitively be done here as well. |
Fixes according to review
Done. |
@@ -531,7 +531,7 @@ define(["structures/ContentTypeGroupInputStruct", "structures/ContentTypeCreateS | |||
* @param callback {Function} callback executed after performing the request (see | |||
* {{#crossLink "ContentTypeService"}}Note on the callbacks usage{{/crossLink}} for more info) | |||
*/ | |||
ContentTypeService.prototype.updateContentTypeDraftMetadata = function updateContentTypeDraftMetadata( | |||
ContentTypeService.prototype.updateContentTypeDraftMetadata = function ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the line change for the parameters is not needed anymore. And the same applies for the loadContentTypeGroupByIdentifier
and updateContentTypeDraftMetadata
methods.
besides my last inline comments, +1 |
this[key] = this.generatePromiseService(this._capi[key]); | ||
for (key in CAPI) { | ||
if ( (typeof CAPI[key] === "function") && (/^(get[^\s(]+Service)/).test(key) ) { | ||
console.log(key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log !
Fixes according to review
Merged |
JIRA issue: https://jira.ez.no/browse/EZP-21666
Classes are fixed and refactored. Tests are on the way...