简体   繁体   中英

How do i make errors use relative paths?

All errors that i encounter use an absolute file path and i feel that it bogs down the console:

Error: Example Error
at fail (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:276:11)
at assertEquals (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:272:7)
at assertPointEquals (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:262:5)
at assertCreatesHWall (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:258:5)
at testMazeStartingPointCreatesEdgeWall (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:243:5)
at run (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:290:7)
at runTestsFromList (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:285:7)
at runTests (file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:223:5)
at file:///C:/Users/Kris/Projects/Programming/Javascript/maze_generation/src/maze.js:373:13

I feel that it would be much easier to see the relevent information if the irrelevent information were excluded. Maybe something like this for example:

Error: Example Error
at fail (file:./maze.js:276:11)
at assertEquals (file:./maze.js:272:7)
at assertPointEquals (file:./maze.js:262:5)
at assertCreatesHWall (file:./maze.js:258:5)
at testMazeStartingPointCreatesEdgeWall (file:./maze.js:243:5)
at run (file:./maze.js:290:7)
at runTestsFromList (file:./maze.js:285:7)
at runTests (file:./maze.js:223:5)
at file:./maze.js:373:13

Is there any way to change that, or is it all closed off?

There may be a configuration in the console that you are using.

What I would do is run a local server. It is fairly trivial to set up a basic one. Look at NodeJS the home page has an example of how to do this with a few lines of code.

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM