2019-08-16 23:21:43 +02:00
|
|
|
/*++
|
|
|
|
Copyright (c) Microsoft Corporation
|
|
|
|
Licensed under the MIT license.
|
|
|
|
|
|
|
|
Module Name:
|
|
|
|
- TerminalWarnings.h
|
|
|
|
|
|
|
|
Abstract:
|
|
|
|
- This file contains definitions for warnings, errors and exceptions used by the
|
|
|
|
Windows Terminal
|
|
|
|
|
|
|
|
Author(s):
|
|
|
|
- Mike Griese - August 2019
|
|
|
|
|
|
|
|
--*/
|
|
|
|
#pragma once
|
|
|
|
|
2020-10-06 18:56:59 +02:00
|
|
|
namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
2019-08-16 23:21:43 +02:00
|
|
|
{
|
|
|
|
// This is a helper class to wrap up a SettingsLoadErrors into a proper
|
|
|
|
// exception type.
|
|
|
|
class SettingsException : public std::runtime_error
|
|
|
|
{
|
|
|
|
public:
|
2020-04-30 01:50:47 +02:00
|
|
|
explicit SettingsException(const SettingsLoadErrors& error) :
|
2019-08-16 23:21:43 +02:00
|
|
|
std::runtime_error{ nullptr },
|
|
|
|
_error{ error } {};
|
|
|
|
|
|
|
|
// We don't use the what() method - we want to be able to display
|
|
|
|
// localizable error messages. Catchers of this exception should use
|
|
|
|
// _GetErrorText (in App.cpp) to get the localized exception string.
|
|
|
|
const char* what() const override
|
|
|
|
{
|
|
|
|
return "Exception while loading or validating Terminal settings";
|
|
|
|
};
|
|
|
|
|
|
|
|
SettingsLoadErrors Error() const noexcept { return _error; };
|
|
|
|
|
|
|
|
private:
|
|
|
|
const SettingsLoadErrors _error;
|
|
|
|
};
|
|
|
|
};
|