mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
🐛 Added 409 DisabledFeatureError for labs features (#8890)
fixes #8889 - This is a user error, not a system error - Downgrading to a 4xx status code means it doesn't appear in logs where it shouldn't - We didn't have a suitable error available so I added DisabledFeatureError with 409 status - Ref: https://stackoverflow.com/questions/36874263/expected-http-status-code-for-an-action-on-a-disabled-resource - Also tweaked the error message slightly as it didn't read clearly to me
This commit is contained in:
parent
bd41dba35b
commit
852155075f
@ -54,6 +54,12 @@ var ghostErrors = {
|
||||
errorType: 'ThemeValidationError',
|
||||
errorDetails: {}
|
||||
}, options));
|
||||
},
|
||||
DisabledFeatureError: function DisabledFeatureError(options) {
|
||||
GhostError.call(this, _.merge({
|
||||
statusCode: 409,
|
||||
errorType: 'DisabledFeatureError',
|
||||
}, options));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -485,7 +485,7 @@
|
||||
},
|
||||
"helpers": {
|
||||
"helperNotAvailable": "The \\{\\{{helperName}\\}\\} helper is not available.",
|
||||
"flagMustBeEnabled": "The {flagName} labs flag must be enabled if you wish to use the \\{\\{{helperName}\\}\\} helper.",
|
||||
"flagMustBeEnabled": "The {flagName} flag must be enabled in labs if you wish to use the \\{\\{{helperName}\\}\\} helper.",
|
||||
"seeLink": "See {url}",
|
||||
"foreach": {
|
||||
"iteratorNeeded": "Need to pass an iterator to #foreach"
|
||||
|
@ -30,7 +30,7 @@ labs.enabledHelper = function enabledHelper(options, callback) {
|
||||
help: i18n.t('warnings.helpers.seeLink', {url: options.helpUrl})
|
||||
};
|
||||
|
||||
logging.error(new errors.GhostError(errDetails));
|
||||
logging.error(new errors.DisabledFeatureError(errDetails));
|
||||
|
||||
errString = new SafeString(
|
||||
'<script>console.error("' + _.values(errDetails).join(' ') + '");</script>'
|
||||
|
@ -45,7 +45,7 @@ describe('{{#get}} helper', function () {
|
||||
result().should.be.an.Object().with.property(
|
||||
'string',
|
||||
'<script>console.error("The {{get}} helper is not available. ' +
|
||||
'The Public API labs flag must be enabled if you wish to use the {{get}} helper. ' +
|
||||
'The Public API flag must be enabled in labs if you wish to use the {{get}} helper. ' +
|
||||
'See https://help.ghost.org/hc/en-us/articles/115000301672-Public-API-Beta");</script>'
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user