Catch exception when creating app settings objects

These settings objects could be created in a constructor/destructor
so we should catch the exception since those are noexcept.

Also change the settings trace to match the other kicad traces
as KICAD_SETTINGS
This commit is contained in:
Ian McInerney 2020-09-21 12:05:31 +01:00
parent 542f447daa
commit 9e6a1225db
10 changed files with 23 additions and 20 deletions

View File

@ -28,7 +28,6 @@
#include <wx/config.h>
#include <wx/log.h>
extern const char* traceSettings;
///! Update the schema version whenever a migration is required
const int projectFileSchemaVersion = 1;

View File

@ -25,8 +25,6 @@
#include <settings/settings_manager.h>
extern const char* traceSettings;
///! Update the schema version whenever a migration is required
const int colorsSchemaVersion = 1;

View File

@ -28,9 +28,6 @@
using KIGFX::MOUSE_DRAG_ACTION;
extern const char* traceSettings;
///! Update the schema version whenever a migration is required
const int commonSchemaVersion = 1;

View File

@ -33,8 +33,7 @@
#include <wx/debug.h>
#include <wx/filename.h>
extern const char* traceSettings;
const wxChar* const traceSettings = wxT( "KICAD_SETTINGS" );
JSON_SETTINGS::JSON_SETTINGS( const wxString& aFilename, SETTINGS_LOC aLocation,
int aSchemaVersion, bool aCreateIfMissing, bool aCreateIfDefault,

View File

@ -22,8 +22,6 @@
#include <settings/nested_settings.h>
extern const char* traceSettings;
NESTED_SETTINGS::NESTED_SETTINGS( const std::string& aName, int aVersion, JSON_SETTINGS* aParent,
const std::string& aPath ) :

View File

@ -41,12 +41,6 @@
#include <wildcards_and_files_ext.h>
/**
* Flag to enable settings tracing
* @ingroup trace_env_vars
*/
const char* traceSettings = "SETTINGS";
/// Project settings path will be <projectname> + this
#define PROJECT_BACKUPS_DIR_SUFFIX wxT( "-backups" )

View File

@ -32,6 +32,14 @@ class NESTED_SETTINGS;
class PARAM_BASE;
class SETTINGS_MANAGER;
/**
* Flag to enable debug output of settings operations and management.
*
* Use "KICAD_SETTINGS" to enable.
*
* @ingroup trace_env_vars
*/
extern const wxChar* const traceSettings;
enum class SETTINGS_LOC {
USER, ///< The main config directory (e.g. ~/.config/kicad/)

View File

@ -94,9 +94,21 @@ public:
} );
if( it != m_settings.end() )
{
ret = dynamic_cast<AppSettings*>( it->get() );
}
else
ret = static_cast<AppSettings*>( RegisterSettings( new AppSettings, aLoadNow ) );
{
try
{
ret = static_cast<AppSettings*>( RegisterSettings( new AppSettings, aLoadNow ) );
}
catch( ... )
{
wxLogTrace( traceSettings, "Unable to create application settings object" );
}
}
return ret;
}

View File

@ -177,7 +177,7 @@ extern const wxChar* const traceSchSheetPaths;
/**
* Flag to enable debug output of environment variable operations.
*
* Use "KICAD_ENV_VARS" to enable
* Use "KICAD_ENV_VARS" to enable.
*
*/
extern const wxChar* const traceEnvVars;

View File

@ -29,8 +29,6 @@
#include <base_units.h>
#include <widgets/ui_common.h>
extern const char* traceSettings;
///! Update the schema version whenever a migration is required
const int fpEditSchemaVersion = 1;