How to use the PreconditionFailed function from http-errors
Find comprehensive JavaScript http-errors.PreconditionFailed code examples handpicked from public code repositorys.
63 64 65 66 67 68 69 70 71 72
lengthRequired: function lengthRequired (message) { return new createError.LengthRequired(message) }, preconditionFailed: function preconditionFailed (message) { return new createError.PreconditionFailed(message) }, payloadTooLarge: function payloadTooLarge (message) { return new createError.PayloadTooLarge(message)
30
340
17
+ 55 other calls in file
GitHub: maniacs-db/arangodb
124 125 126 127 128 129 130 131 132 133
} if (req.headers['if-match']) { if (rev !== req.headers['if-match'].replace(/(^["']|["']$)/g, '')) { throw Object.assign( new httperr.PreconditionFailed('wrong revision'), {errorNum: errors.ERROR_GRAPH_INVALID_VERTEX.code} ); } }
813
0
2
+ 3 other calls in file
106 107 108 109 110 111 112 113 114 115
} async function validateDeletePreconditions ({ user, namespace }) { const shootList = await shoots.list({ user, namespace }) if (!_.isEmpty(shootList.items)) { throw new PreconditionFailed('Only empty projects can be deleted') } } function getProjectName (namespace) {
87
0
0
2 3 4 5 6 7 8 9 10 11
const middleware = () => { return ({ before: (handler, next) => { if (!middleware().checkKmsConfig(handler.event)) { throw new createError.PreconditionFailed({ errors: [{ message: 'Precondition Failed: masterApiKey' }] }); } return next(); }, checkKmsConfig: (event) => {
6
103
9
22 23 24 25 26 27 28 29 30 31
'The supplied email activation token is invalid or has expired' ) module.exports.DeleteNotAllowed = new HTTPErrors.PreconditionFailed( 'Cannot delete the supplied email because users should have at least one email address linked to their account' ) module.exports.EmailAlreadyActivated = new HTTPErrors.PreconditionFailed( 'This email is already active and cannot be activated again' ) /* Entities related errors */
1
0
7
+ 461 other calls in file
97 98 99 100 101 102 103 104 105 106
case 411: { httpError = createError.LengthRequired(); break; } case 412: { httpError = createError.PreconditionFailed(); break; } case 413: { httpError = createError.PayloadTooLarge();
0
0
2
+ 41 other calls in file
http-errors.NotFound is the most popular function in http-errors (1819 examples)