landgreen / n-gon

2-d physics rogue-lite platformer shooter
https://landgreen.github.io/n-gon/
GNU General Public License v3.0
134 stars 193 forks source link

Suggestion: log errors in in-game console #285

Open kgurchiek opened 2 days ago

kgurchiek commented 2 days ago

Many people either can't or don't know to open dev tools to access the console to view error messages when they encounter a bug, so if you had it log to the in-game console on the bottom left it could help people report bugs.

window.addEventListener('error', error => {
  simulation.makeTextLog(`<strong style='color:red;'>ERROR:</strong> ${error.message}  <u>${error.filename}:${error.lineno}</u>`)
});
landgreen commented 2 days ago

I looked into sending all console messages to the in-game console a year ago. I can't remember why I didn't add it to the game. Anyways, let's add in your idea and see what happens.