bug: `Unkown Error!` being spammed over and over on application launch with improperly formatted JSON
GeckoEidechse opened this issue · comments
Describe the bug
If Viper receives an empty manifest.json
, it will repeatedly try to "repair" it and fail doing so. It also creates an error toast each time. I highly suggest stopping any background process if it hits multiple errors.
To Reproduce
Steps to reproduce the behavior:
- Create an empty
manifest.json
in some Northstar mod folder. - Launch viper
- tada
Expected behavior
Viper should throw the error only once.
Version:
v1.6.3
Additional Info
Launching via console I can extract the following error message:
Error
at new JsonRepairError (C:\Users\Gecko\AppData\Local\Programs\viper\resources\app.asar\node_modules\jsonrepair\lib\cjs\JsonRepairError.js:15:16)
at parseEnd (C:\Users\Gecko\AppData\Local\Programs\viper\resources\app.asar\node_modules\jsonrepair\lib\cjs\jsonrepair.js:706:11)
at parseSymbol (C:\Users\Gecko\AppData\Local\Programs\viper\resources\app.asar\node_modules\jsonrepair\lib\cjs\jsonrepair.js:696:3)
at parseNumber (C:\Users\Gecko\AppData\Local\Programs\viper\resources\app.asar\node_modules\jsonrepair\lib\cjs\jsonrepair.js:627:3)
at parseString (C:\Users\Gecko\AppData\Local\Programs\viper\resources\app.asar\node_modules\jsonrepair\lib\cjs\jsonrepair.js:614:3)
at parseArray (C:\Users\Gecko\AppData\Local\Programs\viper\resources\app.asar\node_modules\jsonrepair\lib\cjs\jsonrepair.js:585:3)
at parseObject (C:\Users\Gecko\AppData\Local\Programs\viper\resources\app.asar\node_modules\jsonrepair\lib\cjs\jsonrepair.js:528:3)
at jsonrepair (C:\Users\Gecko\AppData\Local\Programs\viper\resources\app.asar\node_modules\jsonrepair\lib\cjs\jsonrepair.js:108:3)
at C:\Users\Gecko\AppData\Local\Programs\viper\resources\app.asar\src\utils.js:563:33
at Array.forEach (<anonymous>)
at Object.list (C:\Users\Gecko\AppData\Local\Programs\viper\resources\app.asar\src\utils.js:542:9)
at IpcMainImpl.<anonymous> (C:\Users\Gecko\AppData\Local\Programs\viper\resources\app.asar\src\index.js:73:73)
at IpcMainImpl.emit (node:events:394:28)
at Timeout._onTimeout (C:\Users\Gecko\AppData\Local\Programs\viper\resources\app.asar\src\utils.js:999:11)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7) {
message: 'Unexpected end of json string (char 1)',
char: 1
}
If something in this bug report is phrased a bit weirdly, it's cause it was originally a bug report about Viper just spamming error messages but in the process of writing the report, I found the file causing it and as such rewrote the report accordingly ^^
I've been meaning to create a filereader.js
module for a while fixing all this and making it far easier to read JSON, while also always applying the repair function on it, besides just reading and repairing it would also be able to return false
on errors etc. And we can handle it far simpler with that.
TL;DR: I'll get around to fixing this and many other JSON related errors whenever I find the time for it :p