diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-08-17 13:04:33 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-08-17 13:31:22 +0200 |
commit | d3153c28f0b82ca047a892f6dbcd9d5f9344e3d5 (patch) | |
tree | dc06516ab438b65a025d5e5c0bab9cc97735e2ee /drivers | |
parent | de4aabe89b7b68677f145f21c956183bbc92f686 (diff) |
Replace last occurrences of 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG'
The last remaining ERR_EXPLAIN call is in FreeType code and makes sense as is
(conditionally defines the error message).
There are a few ERR_EXPLAINC calls for C-strings where String is not included
which can stay as is to avoid adding additional _MSGC macros just for that.
Part of #31244.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/windows/file_access_windows.cpp | 5 | ||||
-rw-r--r-- | drivers/xaudio2/audio_driver_xaudio2.cpp | 21 |
2 files changed, 8 insertions, 18 deletions
diff --git a/drivers/windows/file_access_windows.cpp b/drivers/windows/file_access_windows.cpp index 7a75732525..c12a2d75a8 100644 --- a/drivers/windows/file_access_windows.cpp +++ b/drivers/windows/file_access_windows.cpp @@ -125,6 +125,7 @@ Error FileAccessWindows::_open(const String &p_path, int p_mode_flags) { return OK; } } + void FileAccessWindows::close() { if (!f) @@ -167,11 +168,11 @@ void FileAccessWindows::close() { if (close_fail_notify) { close_fail_notify(save_path); } - - ERR_EXPLAIN("Safe save failed. This may be a permissions problem, but also may happen because you are running a paranoid antivirus. If this is the case, please switch to Windows Defender or disable the 'safe save' option in editor settings. This makes it work, but increases the risk of file corruption in a crash."); } save_path = ""; + + ERR_FAIL_COND_MSG(rename_error, "Safe save failed. This may be a permissions problem, but also may happen because you are running a paranoid antivirus. If this is the case, please switch to Windows Defender or disable the 'safe save' option in editor settings. This makes it work, but increases the risk of file corruption in a crash."); } } diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp index 8674d24af6..6d729c50ab 100644 --- a/drivers/xaudio2/audio_driver_xaudio2.cpp +++ b/drivers/xaudio2/audio_driver_xaudio2.cpp @@ -63,15 +63,10 @@ Error AudioDriverXAudio2::init() { HRESULT hr; hr = XAudio2Create(&xaudio, 0, XAUDIO2_DEFAULT_PROCESSOR); - if (hr != S_OK) { - ERR_EXPLAIN("Error creating XAudio2 engine."); - ERR_FAIL_V(ERR_UNAVAILABLE); - } + ERR_FAIL_COND_V_MSG(hr != S_OK, ERR_UNAVAILABLE, "Error creating XAudio2 engine."); + hr = xaudio->CreateMasteringVoice(&mastering_voice); - if (hr != S_OK) { - ERR_EXPLAIN("Error creating XAudio2 mastering voice."); - ERR_FAIL_V(ERR_UNAVAILABLE); - } + ERR_FAIL_COND_V_MSG(hr != S_OK, ERR_UNAVAILABLE, "Error creating XAudio2 mastering voice."); wave_format.nChannels = channels; wave_format.cbSize = 0; @@ -82,10 +77,7 @@ Error AudioDriverXAudio2::init() { wave_format.nAvgBytesPerSec = mix_rate * wave_format.nBlockAlign; hr = xaudio->CreateSourceVoice(&source_voice, &wave_format, 0, XAUDIO2_MAX_FREQ_RATIO, &voice_callback); - if (hr != S_OK) { - ERR_EXPLAIN("Error creating XAudio2 source voice. " + itos(hr)); - ERR_FAIL_V(ERR_UNAVAILABLE); - } + ERR_FAIL_COND_V_MSG(hr != S_OK, ERR_UNAVAILABLE, "Error creating XAudio2 source voice. Error code: " + itos(hr) + "."); mutex = Mutex::create(); thread = Thread::create(AudioDriverXAudio2::thread_func, this); @@ -140,10 +132,7 @@ void AudioDriverXAudio2::start() { active = true; HRESULT hr = source_voice->Start(0); - if (hr != S_OK) { - ERR_EXPLAIN("XAudio2 start error " + itos(hr)); - ERR_FAIL(); - } + ERR_FAIL_COND_MSG(hr != S_OK, "Error starting XAudio2 driver. Error code: " + itos(hr) + "."); } int AudioDriverXAudio2::get_mix_rate() const { |