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 /editor/plugins | |
parent | de03ee94cc4df1a451c6f64e984b1da307d0f4b4 (diff) | |
parent | 17732fe698b835c29f77c84f329b2ed6cab215ce (diff) |
Merge pull request #32051 from qarmin/some_error_explanation
Added some obvious errors explanations
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/cpu_particles_2d_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/curve_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/mesh_library_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/particles_2d_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 7 | ||||
-rw-r--r-- | editor/plugins/theme_editor_plugin.cpp | 2 |
7 files changed, 9 insertions, 12 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index d7451849a1..831b1434f3 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -736,8 +736,8 @@ void AnimationPlayerEditor::_dialog_action(String p_file) { ERR_FAIL_COND(!player); Ref<Resource> res = ResourceLoader::load(p_file, "Animation"); - ERR_FAIL_COND(res.is_null()); - ERR_FAIL_COND(!res->is_class("Animation")); + ERR_FAIL_COND_MSG(res.is_null(), "Cannot load Animation from file '" + p_file + "'."); + ERR_FAIL_COND_MSG(!res->is_class("Animation"), "Loaded resource from file '" + p_file + "' is not Animation."); if (p_file.find_last("/") != -1) { p_file = p_file.substr(p_file.find_last("/") + 1, p_file.length()); diff --git a/editor/plugins/cpu_particles_2d_editor_plugin.cpp b/editor/plugins/cpu_particles_2d_editor_plugin.cpp index 9d625af959..374900d4c7 100644 --- a/editor/plugins/cpu_particles_2d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_2d_editor_plugin.cpp @@ -87,7 +87,7 @@ void CPUParticles2DEditorPlugin::_generate_emission_mask() { Ref<Image> img; img.instance(); Error err = ImageLoader::load_image(source_emission_file, img); - ERR_FAIL_COND_MSG(err != OK, "Error loading image: " + source_emission_file + "."); + ERR_FAIL_COND_MSG(err != OK, "Error loading image '" + source_emission_file + "'."); if (img->is_compressed()) { img->decompress(); diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index c2b6031e60..98db911799 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -779,7 +779,7 @@ bool CurvePreviewGenerator::handles(const String &p_type) const { Ref<Texture> CurvePreviewGenerator::generate(const Ref<Resource> &p_from, const Size2 &p_size) const { Ref<Curve> curve_ref = p_from; - ERR_FAIL_COND_V(curve_ref.is_null(), Ref<Texture>()); + ERR_FAIL_COND_V_MSG(curve_ref.is_null(), Ref<Texture>(), "It's not a reference to a valid Resource object."); Curve &curve = **curve_ref; // FIXME: Should be ported to use p_size as done in b2633a97 diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index 1fc6dae978..7fbb35e565 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -201,7 +201,7 @@ void MeshLibraryEditor::_import_scene_cbk(const String &p_str) { ERR_FAIL_COND(ps.is_null()); Node *scene = ps->instance(); - ERR_FAIL_COND(!scene); + ERR_FAIL_COND_MSG(!scene, "Cannot create an instance from PackedScene '" + p_str + "'."); _import_scene(scene, mesh_library, option == MENU_OPTION_UPDATE_FROM_SCENE); diff --git a/editor/plugins/particles_2d_editor_plugin.cpp b/editor/plugins/particles_2d_editor_plugin.cpp index 8025e12885..957ce42304 100644 --- a/editor/plugins/particles_2d_editor_plugin.cpp +++ b/editor/plugins/particles_2d_editor_plugin.cpp @@ -160,7 +160,7 @@ void Particles2DEditorPlugin::_generate_emission_mask() { Ref<Image> img; img.instance(); Error err = ImageLoader::load_image(source_emission_file, img); - ERR_FAIL_COND_MSG(err != OK, "Error loading image: " + source_emission_file + "."); + ERR_FAIL_COND_MSG(err != OK, "Error loading image '" + source_emission_file + "'."); if (img->is_compressed()) { img->decompress(); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 4c22138a20..80b0f0738a 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1973,7 +1973,7 @@ Ref<TextFile> ScriptEditor::_load_text_file(const String &p_path, Error *r_error Ref<TextFile> text_res(text_file); Error err = text_file->load_text(path); - ERR_FAIL_COND_V(err != OK, RES()); + ERR_FAIL_COND_V_MSG(err != OK, RES(), "Cannot load text file '" + path + "'."); text_file->set_file_path(local_path); text_file->set_path(local_path, true); @@ -1998,10 +1998,7 @@ Error ScriptEditor::_save_text_file(Ref<TextFile> p_text_file, const String &p_p Error err; FileAccess *file = FileAccess::open(p_path, FileAccess::WRITE, &err); - if (err) { - - ERR_FAIL_COND_V(err, err); - } + ERR_FAIL_COND_V_MSG(err, err, "Cannot save text file '" + p_path + "'."); file->store_string(source); if (file->get_error() != OK && file->get_error() != ERR_FILE_EOF) { diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 3055a9382c..d501a04016 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -192,7 +192,7 @@ void ThemeEditor::_save_template_cbk(String fname) { FileAccess *file = FileAccess::open(filename, FileAccess::WRITE); - ERR_FAIL_COND_MSG(!file, "Can't save theme to file: " + filename + "."); + ERR_FAIL_COND_MSG(!file, "Can't save theme to file '" + filename + "'."); file->store_line("; ******************* "); file->store_line("; Template Theme File "); |