How to use the BadGateway function from http-errors
Find comprehensive JavaScript http-errors.BadGateway code examples handpicked from public code repositorys.
GitHub: bengl/undici
209 210 211 212 213 214 215 216 217 218
`proto=${socket.encrypted ? 'https' : 'http'}`, `host=${printIp(authority || host || '')}` ].join(';')) } else if (forwarded) { // The forwarded header should not be included in response. throw new createError.BadGateway() } if (proxyName) { if (via) {
354
0
1
142 143 144 145 146 147 148 149 150 151
notImplemented: function notImplemented (message) { return new createError.NotImplemented(message) }, badGateway: function badGateway (message) { return new createError.BadGateway(message) }, serviceUnavailable: function serviceUnavailable (message) { return new createError.ServiceUnavailable(message)
30
340
17
+ 55 other calls in file
13 14 15 16 17 18 19 20 21
transporter.sendMail(transporterOptions, (err, info) => { if (err) { if (NODE_ENV === 'development') console.log(`Transporter error: ${err}`) reject(new createErrors.BadGateway(err.message || 'Email not sent')) } if (NODE_ENV === 'development') console.log(`Transporter success: ${JSON.stringify(info)}`)
4
2
1
GitHub: mfolkeseth/core
180 181 182 183 184 185 186 187 188
versions.setVersion(pVersion, pkg.integrity); try { await this._writeVersions(incoming, versions); } catch (error) { const e = new HttpError.BadGateway(); end({ labels: { success: false, status: e.status, type } }); throw e; }
2
1
1
171 172 173 174 175 176 177 178 179 180
module.exports.TooManyRequests = new HTTPErrors.TooManyRequests() module.exports.RequestHeaderFieldsTooLarge = new HTTPErrors.RequestHeaderFieldsTooLarge() module.exports.UnavailableForLegalReasons = new HTTPErrors.UnavailableForLegalReasons() module.exports.InternalServerError = new HTTPErrors.InternalServerError() module.exports.NotImplemented = new HTTPErrors.NotImplemented() module.exports.BadGateway = new HTTPErrors.BadGateway() module.exports.ServiceUnavailable = new HTTPErrors.ServiceUnavailable() module.exports.GatewayTimeout = new HTTPErrors.GatewayTimeout() module.exports.HTTPVersionNotSupported = new HTTPErrors.HTTPVersionNotSupported() module.exports.VariantAlsoNegotiates = new HTTPErrors.VariantAlsoNegotiates()
1
0
7
+ 41 other calls in file
165 166 167 168 169 170 171 172 173 174
case 501: { httpError = createError.NotImplemented(); break; } case 502: { httpError = createError.BadGateway(); break; } case 503: { httpError = createError.ServiceUnavailable();
0
0
2
+ 41 other calls in file
http-errors.NotFound is the most popular function in http-errors (1819 examples)