487 matches across 25 files for error
snippet_mode: grep · sorted by relevance
.eslintrc.yml YAML 6 matches · showing 5 view file →
4 node: true
5rules:
6 eol-last: error
7 eqeqeq: [error, allow-null]
8 indent: [error, 2, { MemberExpression: "off", SwitchCase: 1 }]
· · ·
7 eqeqeq: [error, allow-null]
8 indent: [error, 2, { MemberExpression: "off", SwitchCase: 1 }]
9 no-trailing-spaces: error
· · ·
8 indent: [error, 2, { MemberExpression: "off", SwitchCase: 1 }]
9 no-trailing-spaces: error
10 no-unused-vars: [error, { vars: all, args: none, ignoreRestSiblings: true }]
· · ·
9 no-trailing-spaces: error
10 no-unused-vars: [error, { vars: all, args: none, ignoreRestSiblings: true }]
11 no-restricted-globals:
· · ·
10 no-unused-vars: [error, { vars: all, args: none, ignoreRestSiblings: true }]
11 no-restricted-globals:
12 - error
+ 1 more matches in this file
.github/workflows/ci.yml YAML 1 matches view file →
65 - name: Configure npm loglevel
66 run: |
67 npm config set loglevel error
68 shell: bash
69
.github/workflows/legacy.yml YAML 1 matches view file →
49 - name: Configure npm loglevel
50 run: |
51 npm config set loglevel error
52 shell: bash
53
.gitignore GITIGNORE 1 matches view file →
7
8# Yarn
9yarn-error.log
10yarn.lock
11
History.md MARKDOWN 114 matches · showing 5 view file →
5* Improve HTML structure in `res.redirect()` responses when HTML format is accepted by adding `<!DOCTYPE html>`, `<title>`, and `<body>` tags for better browser compatibility - by [@Bernice55231](https://github.com/Bernice55231) in [#5167](https://github.com/expressjs/express/pull/5167)
6
7* When calling `app.render` with options set to null, the locals object is handled correctly, preventing unexpected errors and making the method behave the same as when options is omitted or an empty object is passed - by [AkaHarshit](https://github.com/AkaHarshit) in [#6903](https://github.com/expressjs/express/pull/6903)
8
9 ```js
· · ·
62* breaking:
63 * `res.status()` accepts only integers, and input must be greater than 99 and less than 1000
64 * will throw a `RangeError: Invalid status code: ${code}. Status code must be greater than 99 and less than 1000.` for inputs outside this range
65 * will throw a `TypeError: Invalid status code: ${code}. Status code must be an integer.` for non integer inputs
66 * deps: send@1.0.0
· · ·
65 * will throw a `TypeError: Invalid status code: ${code}. Status code must be an integer.` for non integer inputs
66 * deps: send@1.0.0
67 * `res.redirect('back')` and `res.location('back')` is no longer a supported magic string, explicitly use `req.get('Referrer') || '/'`.
· · ·
188
189 * remove:
190 - Remove Express 3.x middleware error stubs
191 * deps: router@~1.3.0
192 - Add `next("router")` to exit from router
· · ·
292 * Fix routing requests without method
293 * deps: body-parser@1.20.2
294 - Fix strict json error message on Node.js 19+
295 - deps: content-type@~1.0.5
296 - deps: raw-body@2.5.2
+ 109 more matches in this file
examples/README.md MARKDOWN 2 matches view file →
9- [downloads](./downloads) - Transferring files to client
10- [ejs](./ejs) - Working with Embedded JavaScript templating (ejs)
11- [error-pages](./error-pages) - Creating error pages
12- [error](./error) - Working with error middleware
13- [hello-world](./hello-world) - Simple request handler
· · ·
12- [error](./error) - Working with error middleware
13- [hello-world](./hello-world) - Simple request handler
14- [markdown](./markdown) - Markdown as template engine
examples/auth/index.js JAVASCRIPT 5 matches view file →
29
30app.use(function(req, res, next){
31 var err = req.session.error;
32 var msg = req.session.success;
33 delete req.session.error;
· · ·
33 delete req.session.error;
34 delete req.session.success;
35 res.locals.message = '';
· · ·
36 if (err) res.locals.message = '<p class="msg error">' + err + '</p>';
37 if (msg) res.locals.message = '<p class="msg success">' + msg + '</p>';
38 next();
· · ·
77 next();
78 } else {
79 req.session.error = 'Access denied!';
80 res.redirect('/login');
81 }
· · ·
120 });
121 } else {
122 req.session.error = 'Authentication failed, please check your '
123 + ' username and password.'
124 + ' (use "tj" and "foobar")';
examples/auth/views/head.ejs 1 matches view file →
10 font: 13px Helvetica, Arial, sans-serif;
11 }
12 .error {
13 color: red;
14 }
examples/downloads/index.js JAVASCRIPT 1 matches view file →
27 res.download(req.params.file.join('/'), { root: FILES_DIR }, function (err) {
28 if (!err) return; // file sent
29 if (err.status !== 404) return next(err); // non-404 error
30 // file for download not found
31 res.statusCode = 404;
examples/error-pages/index.js JAVASCRIPT 20 matches · showing 5 view file →
15app.set('view engine', 'ejs');
16
17// our custom "verbose errors" setting
18// which we can use in the templates
19// via settings['verbose errors']
· · ·
19// via settings['verbose errors']
20app.enable('verbose errors');
21
· · ·
20app.enable('verbose errors');
21
22// disable them in production
· · ·
23// use $ NODE_ENV=production node examples/error-pages
24if (app.settings.env === 'production') app.disable('verbose errors')
25
· · ·
24if (app.settings.env === 'production') app.disable('verbose errors')
25
26silent || app.use(logger('dev'));
+ 15 more matches in this file
examples/error-pages/views/404.ejs 1 matches view file →
1<%- include('error_header') -%>
2<h2>Cannot find <%= url %></h2>
3<%- include('footer') -%>
examples/error-pages/views/500.ejs 5 matches view file →
1<%- include('error_header') -%>
2<h2>Error: <%= error.message %></h2>
3<% if (settings['verbose errors']) { %>
· · ·
2<h2>Error: <%= error.message %></h2>
3<% if (settings['verbose errors']) { %>
4 <pre><%= error.stack %></pre>
· · ·
3<% if (settings['verbose errors']) { %>
4 <pre><%= error.stack %></pre>
5<% } else { %>
· · ·
4 <pre><%= error.stack %></pre>
5<% } else { %>
6 <p>An error occurred!</p>
· · ·
6 <p>An error occurred!</p>
7<% } %>
8<%- include('footer') -%>
examples/error-pages/views/error_header.ejs 2 matches view file →
4<meta charset="utf-8">
5<meta name="viewport" content="width=device-width,initial-scale=1">
6<title>Error</title>
7</head>
8
· · ·
9<body>
10<h1>An error occurred!</h1>
11
examples/error/index.js JAVASCRIPT 11 matches · showing 5 view file →
12if (!test) app.use(logger('dev'));
13
14// error handling middleware have an arity of 4
15// instead of the typical (req, res, next),
16// otherwise they behave exactly like regular
· · ·
18// in different orders etc.
19
20function error(err, req, res, next) {
21 // log it
22 if (!test) console.error(err.stack);
· · ·
22 if (!test) console.error(err.stack);
23
24 // respond with 500 "Internal Server Error".
· · ·
24 // respond with 500 "Internal Server Error".
25 res.status(500);
26 res.send('Internal Server Error');
· · ·
26 res.send('Internal Server Error');
27}
28
+ 6 more matches in this file
examples/mvc/index.js JAVASCRIPT 3 matches view file →
17app.set('view engine', 'ejs');
18
19// set views for error and 404 pages
20app.set('views', path.join(__dirname, 'views'));
21
· · ·
78app.use(function(err, req, res, next){
79 // log it
80 if (!module.parent) console.error(err.stack);
81
82 // error page
· · ·
82 // error page
83 res.status(500).render('5xx');
84});
examples/mvc/lib/boot.js JAVASCRIPT 1 matches view file →
61 default:
62 /* istanbul ignore next */
63 throw new Error('unrecognized route: ' + name + '.' + key);
64 }
65
examples/mvc/views/5xx.ejs 2 matches view file →
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width,initial-scale=1">
6 <title>Internal Server Error</title>
7 <link rel="stylesheet" href="/style.css">
8 </head>
· · ·
9 <body>
10 <h1>500: Internal Server Error</h1>
11 <p>Looks like something blew up!</p>
12 </body>
examples/params/index.js JAVASCRIPT 3 matches view file →
5 */
6
7var createError = require('http-errors')
8var express = require('../../');
9var app = module.exports = express();
· · ·
24 req.params[name] = parseInt(num, 10);
25 if( isNaN(req.params[name]) ){
26 next(createError(400, 'failed to parseInt '+num));
27 } else {
28 next();
· · ·
37 next();
38 } else {
39 next(createError(404, 'failed to find user'));
40 }
41});
examples/resource/index.js JAVASCRIPT 2 matches view file →
44 },
45 show: function(req, res){
46 res.send(users[req.params.id] || { error: 'Cannot find user' });
47 },
48 destroy: function(req, res, id){
· · ·
70// curl http://localhost:3000/users -- responds with all users
71// curl http://localhost:3000/users/1 -- responds with user 1
72// curl http://localhost:3000/users/4 -- responds with error
73// curl http://localhost:3000/users/1..3 -- responds with several users
74// curl -X DELETE http://localhost:3000/users/1 -- deletes the user
examples/route-middleware/index.js JAVASCRIPT 5 matches view file →
30 next();
31 } else {
32 next(new Error('Failed to load user ' + req.params.id));
33 }
34}
· · ·
41 } else {
42 // You may want to implement specific exceptions
43 // such as UnauthorizedError or similar so that you
44 // can handle these can be special-cased in an error handler
45 // (view ./examples/pages for this)
· · ·
44 // can handle these can be special-cased in an error handler
45 // (view ./examples/pages for this)
46 next(new Error('Unauthorized'));
· · ·
46 next(new Error('Unauthorized'));
47 }
48}
· · ·
53 next();
54 } else {
55 next(new Error('Unauthorized'));
56 }
57 }
examples/route-separation/user.js JAVASCRIPT 1 matches view file →
18 next();
19 } else {
20 var err = new Error('cannot find user ' + id);
21 err.status = 404;
22 next(err);
examples/search/index.js JAVASCRIPT 2 matches view file →
41 await db.sAdd('cat', 'luna');
42 } catch (err) {
43 console.error('Error initializing Redis:', err);
44 process.exit(1);
45 }
· · ·
55 .then((vals) => res.send(vals))
56 .catch((err) => {
57 console.error(`Redis error for query "${query}":`, err);
58 next(err);
59 });
examples/view-locals/index.js JAVASCRIPT 1 matches view file →
20
21// naive nesting approach,
22// delegating errors to next(err)
23// in order to expose the "count"
24// and "users" locals
examples/web-service/index.js JAVASCRIPT 9 matches · showing 5 view file →
9var app = module.exports = express();
10
11// create an error with .status. we
12// can then use the property in our
13// custom error handler (Connect respects this prop as well)
· · ·
13// custom error handler (Connect respects this prop as well)
14
15function error(status, msg) {
· · ·
15function error(status, msg) {
16 var err = new Error(msg);
17 err.status = status;
· · ·
16 var err = new Error(msg);
17 err.status = status;
18 return err;
· · ·
32
33 // key isn't present
34 if (!key) return next(error(400, 'api key required'));
35
36 // key is invalid
+ 4 more matches in this file
lib/application.js JAVASCRIPT 12 matches · showing 5 view file →
144 * Dispatch a req, res pair into the application. Starts pipeline processing.
145 *
146 * If no callback is provided, then default error handlers will respond
147 * in the event of an error bubbling through the stack.
148 *
· · ·
147 * in the event of an error bubbling through the stack.
148 *
149 * @private
· · ·
154 var done = callback || finalhandler(req, res, {
155 env: this.get('env'),
156 onerror: logerror.bind(this)
157 });
158
· · ·
211
212 if (fns.length === 0) {
213 throw new TypeError('app.use() requires a middleware function')
214 }
215
· · ·
294app.engine = function engine(ext, fn) {
295 if (typeof fn !== 'function') {
296 throw new Error('callback function required');
297 }
298
+ 7 more matches in this file
Search syntax
auth loginboth terms (AND is implicit)
auth OR logineither term
NOT path:vendorexclude matches
"exact phrase"quoted exact match
/func\s+Test/regex
handler~1fuzzy (Levenshtein 1)
file:*_test.gofilename glob
path:pkg/auth/**full path glob
lang:golanguage filter

Search any public repo from your terminal

This page calls POST /api/v1/code_search. Same tool, available over MCP for Claude/Cursor/Copilot.