Skip to content

Commit

Permalink
Display Warning if JSON Parsing fails
Browse files Browse the repository at this point in the history
Display a warning if parsing the JSON file fails.
  • Loading branch information
sieren committed May 27, 2019
1 parent 0988a40 commit 928cf8d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
1 change: 0 additions & 1 deletion main/AppContext.cpp
@@ -1,5 +1,4 @@
#include "AppContext.h"
#include <fs/ConfigReader.hpp>
#include "rapidjson/stringbuffer.h"

#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion main/AppContext.h
Expand Up @@ -4,7 +4,7 @@
#include <mqtt/MQTTGroup.hpp>
#include <ntp/NTPSync.h>
#include <wifi/WifiContext.h>
#include "rapidjson/document.h"
#include <fs/ConfigReader.hpp>
#include <memory>
#include <tuple>
#include <string>
Expand Down
1 change: 1 addition & 0 deletions main/fs/ConfigReader.hpp
@@ -1,5 +1,6 @@
#pragma once

#include <util/warnings.h>
#include "rapidjson/document.h"
#include "Filesystem.h"
#include <mqtt/MQTTConnection.h>
Expand Down
11 changes: 10 additions & 1 deletion main/main.cpp
Expand Up @@ -44,8 +44,17 @@ extern "C"

void setupApp()
{
mpAppContext->setup();
mScreen.setupScreen();

try
{
mpAppContext->setup();
}
catch(const std::exception& e)
{
mScreen.showWarning(e.what());
return;
}
const auto wifiCredentials = fs::ConfigReader::getWifiCredentials();
mpAppContext->getWifiContext().connect(std::get<0>(wifiCredentials), std::get<1>(wifiCredentials));
mScreen.setupData();
Expand Down

0 comments on commit 928cf8d

Please sign in to comment.