File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -418,7 +418,22 @@ void Wippersnapper_FS::parseSecrets() {
418
418
// Attempt to deserialize the file's JSON document
419
419
JsonDocument doc;
420
420
DeserializationError error = deserializeJson (doc, secretsFile);
421
- if (error) {
421
+ if (error == DeserializationError::EmptyInput)
422
+ {
423
+ if (WS.brownOutCausedReset )
424
+ {
425
+ fsHalt (" ERROR: Empty secrets.json file, can't recreate due to brownout - recharge or must be fixed manually." );
426
+ }
427
+ else
428
+ {
429
+ // TODO: Can't serial print here, in next PR check we're not out of space
430
+ WS_DEBUG_PRINTLN (" ERROR: Empty secrets.json file, recreating..." );
431
+ secretsFile.close ();
432
+ createSecretsFile (); // calls fsHalt
433
+ }
434
+ }
435
+ else if (error)
436
+ {
422
437
fsHalt (String (" ERROR: Unable to parse secrets.json file - "
423
438
" deserializeJson() failed with code" ) +
424
439
error.c_str ());
You can’t perform that action at this time.
0 commit comments