How to use the PayloadTooLarge function from http-errors

Find comprehensive JavaScript http-errors.PayloadTooLarge code examples handpicked from public code repositorys.

67
68
69
70
71
72
73
74
75
76
preconditionFailed: function preconditionFailed (message) {
  return new createError.PreconditionFailed(message)
},

payloadTooLarge: function payloadTooLarge (message) {
  return new createError.PayloadTooLarge(message)
},

uriTooLong: function uriTooLong (message) {
  return new createError.URITooLong(message)
fork icon30
star icon340
watch icon17

+ 55 other calls in file

113
114
115
116
117
118
119
120
121
122

file.once('limit', () => {
    this._log.info(
        `multipart - Uploaded package exceeds legal file size limit - Field: ${fieldname} - Filename: ${filename}`,
    );
    file.emit('error', new HttpError.PayloadTooLarge());
});

const extract = new tar.Parse({
    strict: true,
fork icon2
star icon1
watch icon1

94
95
96
97
98
99
100
101
102
103
        "At least one of the user's vote is missing"
)
module.exports.VoteAlreadySubmited = new HTTPErrors.PreconditionFailed(
        "This right holder's vote has already been submited and cannot be submited again"
)
module.exports.FileTooLarge = new HTTPErrors.PayloadTooLarge(
        'File is to large too be uploaded'
)

/* Address related errors */
fork icon1
star icon0
watch icon7

+ 83 other calls in file

101
102
103
104
105
106
107
108
109
110
case 412: {
  httpError = createError.PreconditionFailed();
  break;
}
case 413: {
  httpError = createError.PayloadTooLarge();
  break;
}
case 414: {
  httpError = createError.URITooLong();
fork icon0
star icon0
watch icon2

+ 41 other calls in file