diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-09-25 11:51:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-25 11:51:54 +0200 |
commit | dec10dd776fca2994277faa3a97b13e70317f784 (patch) | |
tree | cea7622b2e2bb0d2cede33274807cb98b4fef856 /platform | |
parent | de03ee94cc4df1a451c6f64e984b1da307d0f4b4 (diff) | |
parent | 17732fe698b835c29f77c84f329b2ed6cab215ce (diff) |
Merge pull request #32051 from qarmin/some_error_explanation
Added some obvious errors explanations
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/export/export.cpp | 6 | ||||
-rw-r--r-- | platform/android/file_access_jandroid.cpp | 14 | ||||
-rw-r--r-- | platform/iphone/export/export.cpp | 8 | ||||
-rw-r--r-- | platform/javascript/api/api.cpp | 2 | ||||
-rw-r--r-- | platform/uwp/export/export.cpp | 2 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 2 |
6 files changed, 17 insertions, 17 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index b37f04c4f8..94dffd8a84 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -598,7 +598,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { String dst_path = String("lib").plus_file(abi).plus_file(p_so.path.get_file()); Vector<uint8_t> array = FileAccess::get_file_as_array(p_so.path); Error store_err = store_in_apk(ed, dst_path, array); - ERR_FAIL_COND_V(store_err, store_err); + ERR_FAIL_COND_V_MSG(store_err, store_err, "Cannot store in apk file '" + dst_path + "'."); } } if (!exported) { @@ -1670,7 +1670,7 @@ public: DirAccessRef da = DirAccess::open("res://android"); - ERR_FAIL_COND(!da); + ERR_FAIL_COND_MSG(!da, "Cannot open directory 'res://android'."); Map<String, List<String> > directory_paths; Map<String, List<String> > manifest_sections; Map<String, List<String> > gradle_sections; @@ -1946,7 +1946,7 @@ public: //build project if custom build is enabled String sdk_path = EDITOR_GET("export/android/custom_build_sdk_path"); - ERR_FAIL_COND_V(sdk_path == "", ERR_UNCONFIGURED); + ERR_FAIL_COND_V_MSG(sdk_path == "", ERR_UNCONFIGURED, "Android SDK path must be configured in Editor Settings at 'export/android/custom_build_sdk_path'."); _update_custom_build_project(); diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp index 5b8cf01138..d4c2a23aa0 100644 --- a/platform/android/file_access_jandroid.cpp +++ b/platform/android/file_access_jandroid.cpp @@ -94,13 +94,13 @@ void FileAccessJAndroid::seek(size_t p_position) { JNIEnv *env = ThreadAndroid::get_env(); - ERR_FAIL_COND(!is_open()); + ERR_FAIL_COND_MSG(!is_open(), "File must be opened before use."); env->CallVoidMethod(io, _file_seek, id, p_position); } void FileAccessJAndroid::seek_end(int64_t p_position) { - ERR_FAIL_COND(!is_open()); + ERR_FAIL_COND_MSG(!is_open(), "File must be opened before use."); seek(get_len()); } @@ -108,34 +108,34 @@ void FileAccessJAndroid::seek_end(int64_t p_position) { size_t FileAccessJAndroid::get_position() const { JNIEnv *env = ThreadAndroid::get_env(); - ERR_FAIL_COND_V(!is_open(), 0); + ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use."); return env->CallIntMethod(io, _file_tell, id); } size_t FileAccessJAndroid::get_len() const { JNIEnv *env = ThreadAndroid::get_env(); - ERR_FAIL_COND_V(!is_open(), 0); + ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use."); return env->CallIntMethod(io, _file_get_size, id); } bool FileAccessJAndroid::eof_reached() const { JNIEnv *env = ThreadAndroid::get_env(); - ERR_FAIL_COND_V(!is_open(), 0); + ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use."); return env->CallIntMethod(io, _file_eof, id); } uint8_t FileAccessJAndroid::get_8() const { - ERR_FAIL_COND_V(!is_open(), 0); + ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use."); uint8_t byte; get_buffer(&byte, 1); return byte; } int FileAccessJAndroid::get_buffer(uint8_t *p_dst, int p_length) const { - ERR_FAIL_COND_V(!is_open(), 0); + ERR_FAIL_COND_V_MSG(!is_open(), 0, "File must be opened before use."); if (p_length == 0) return 0; JNIEnv *env = ThreadAndroid::get_env(); diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 99fbe989df..baae13c53d 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -487,7 +487,7 @@ Error EditorExportPlatformIOS::_export_icons(const Ref<EditorExportPreset> &p_pr String sizes; DirAccess *da = DirAccess::open(p_iconset_dir); - ERR_FAIL_COND_V(!da, ERR_CANT_OPEN); + ERR_FAIL_COND_V_MSG(!da, ERR_CANT_OPEN, "Cannot open directory '" + p_iconset_dir + "'."); for (uint64_t i = 0; i < (sizeof(icon_infos) / sizeof(icon_infos[0])); ++i) { IconInfo info = icon_infos[i]; @@ -537,7 +537,7 @@ Error EditorExportPlatformIOS::_export_icons(const Ref<EditorExportPreset> &p_pr Error EditorExportPlatformIOS::_export_loading_screens(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir) { DirAccess *da = DirAccess::open(p_dest_dir); - ERR_FAIL_COND_V(!da, ERR_CANT_OPEN); + ERR_FAIL_COND_V_MSG(!da, ERR_CANT_OPEN, "Cannot open directory '" + p_dest_dir + "'."); for (uint64_t i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) { LoadingScreenInfo info = loading_screen_infos[i]; @@ -546,7 +546,7 @@ Error EditorExportPlatformIOS::_export_loading_screens(const Ref<EditorExportPre Error err = da->copy(loading_screen_file, p_dest_dir + info.export_name); if (err) { memdelete(da); - String err_str = String("Failed to export loading screen (") + info.preset_key + ") from path: " + loading_screen_file; + String err_str = String("Failed to export loading screen (") + info.preset_key + ") from path '" + loading_screen_file + "'."; ERR_PRINT(err_str.utf8().get_data()); return err; } @@ -757,7 +757,7 @@ void EditorExportPlatformIOS::_add_assets_to_project(const Ref<EditorExportPrese Error EditorExportPlatformIOS::_export_additional_assets(const String &p_out_dir, const Vector<String> &p_assets, bool p_is_framework, Vector<IOSExportAsset> &r_exported_assets) { DirAccess *filesystem_da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - ERR_FAIL_COND_V(!filesystem_da, ERR_CANT_CREATE); + ERR_FAIL_COND_V_MSG(!filesystem_da, ERR_CANT_CREATE, "Cannot create DirAccess for path '" + p_out_dir + "'."); for (int f_idx = 0; f_idx < p_assets.size(); ++f_idx) { String asset = p_assets[f_idx]; if (!asset.begins_with("res://")) { diff --git a/platform/javascript/api/api.cpp b/platform/javascript/api/api.cpp index d4dc43d57c..0832ae0360 100644 --- a/platform/javascript/api/api.cpp +++ b/platform/javascript/api/api.cpp @@ -55,7 +55,7 @@ JavaScript *JavaScript::get_singleton() { JavaScript::JavaScript() { - ERR_FAIL_COND(singleton != NULL); + ERR_FAIL_COND_MSG(singleton != NULL, "JavaScript singleton already exist."); singleton = this; } diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index bb18c2da8a..fefad3584b 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -1249,7 +1249,7 @@ public: Error err = OK; FileAccess *fa_pack = FileAccess::open(p_path, FileAccess::WRITE, &err); - ERR_FAIL_COND_V(err != OK, ERR_CANT_CREATE); + ERR_FAIL_COND_V_MSG(err != OK, ERR_CANT_CREATE, "Cannot create file '" + p_path + "'."); AppxPackager packager; packager.init(fa_pack); diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index be325381bb..facf5b8d91 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2663,7 +2663,7 @@ String OS_Windows::get_executable_path() const { void OS_Windows::set_native_icon(const String &p_filename) { FileAccess *f = FileAccess::open(p_filename, FileAccess::READ); - ERR_FAIL_COND(!f); + ERR_FAIL_COND_MSG(!f, "Cannot open file with icon '" + p_filename + "'."); ICONDIR *icon_dir = (ICONDIR *)memalloc(sizeof(ICONDIR)); int pos = 0; |