Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in "main" and "servers" directories
This commit is contained in:
parent
7bb2215ed0
commit
5ca7460421
|
@ -816,10 +816,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|||
|
||||
String bp = breakpoints[i];
|
||||
int sp = bp.find_last(":");
|
||||
if (sp == -1) {
|
||||
ERR_EXPLAIN("Invalid breakpoint: '" + bp + "', expected file:line format.");
|
||||
ERR_CONTINUE(true);
|
||||
}
|
||||
ERR_CONTINUE_MSG(sp == -1, "Invalid breakpoint: '" + bp + "', expected file:line format.");
|
||||
|
||||
script_debugger->insert_breakpoint(bp.substr(sp + 1, bp.length()).to_int(), bp.substr(0, sp));
|
||||
}
|
||||
|
@ -1375,10 +1372,7 @@ bool Main::start() {
|
|||
|
||||
{
|
||||
DirAccessRef da = DirAccess::open(doc_tool);
|
||||
if (!da) {
|
||||
ERR_EXPLAIN("Argument supplied to --doctool must be a base Godot build directory");
|
||||
ERR_FAIL_V(false);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(!da, false, "Argument supplied to --doctool must be a base Godot build directory.");
|
||||
}
|
||||
DocData doc;
|
||||
doc.generate(doc_base);
|
||||
|
@ -1462,8 +1456,7 @@ bool Main::start() {
|
|||
} else if (script != "") {
|
||||
|
||||
Ref<Script> script_res = ResourceLoader::load(script);
|
||||
ERR_EXPLAIN("Can't load script: " + script);
|
||||
ERR_FAIL_COND_V(script_res.is_null(), false);
|
||||
ERR_FAIL_COND_V_MSG(script_res.is_null(), false, "Can't load script: " + script);
|
||||
|
||||
if (check_only) {
|
||||
return false;
|
||||
|
@ -1477,8 +1470,7 @@ bool Main::start() {
|
|||
if (!script_loop) {
|
||||
if (obj)
|
||||
memdelete(obj);
|
||||
ERR_EXPLAIN("Can't load script '" + script + "', it does not inherit from a MainLoop type");
|
||||
ERR_FAIL_V(false);
|
||||
ERR_FAIL_V_MSG(false, "Can't load script '" + script + "', it does not inherit from a MainLoop type.");
|
||||
}
|
||||
|
||||
script_loop->set_init_script(script_res);
|
||||
|
@ -1502,17 +1494,13 @@ bool Main::start() {
|
|||
} else {
|
||||
|
||||
Object *ml = ClassDB::instance(main_loop_type);
|
||||
if (!ml) {
|
||||
ERR_EXPLAIN("Can't instance MainLoop type");
|
||||
ERR_FAIL_V(false);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(!ml, false, "Can't instance MainLoop type.");
|
||||
|
||||
main_loop = Object::cast_to<MainLoop>(ml);
|
||||
if (!main_loop) {
|
||||
|
||||
memdelete(ml);
|
||||
ERR_EXPLAIN("Invalid MainLoop type");
|
||||
ERR_FAIL_V(false);
|
||||
ERR_FAIL_V_MSG(false, "Invalid MainLoop type.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1575,8 +1563,7 @@ bool Main::start() {
|
|||
}
|
||||
|
||||
RES res = ResourceLoader::load(path);
|
||||
ERR_EXPLAIN("Can't autoload: " + path);
|
||||
ERR_CONTINUE(res.is_null());
|
||||
ERR_CONTINUE_MSG(res.is_null(), "Can't autoload: " + path);
|
||||
Node *n = NULL;
|
||||
if (res->is_class("PackedScene")) {
|
||||
Ref<PackedScene> ps = res;
|
||||
|
@ -1585,20 +1572,17 @@ bool Main::start() {
|
|||
Ref<Script> script_res = res;
|
||||
StringName ibt = script_res->get_instance_base_type();
|
||||
bool valid_type = ClassDB::is_parent_class(ibt, "Node");
|
||||
ERR_EXPLAIN("Script does not inherit a Node: " + path);
|
||||
ERR_CONTINUE(!valid_type);
|
||||
ERR_CONTINUE_MSG(!valid_type, "Script does not inherit a Node: " + path);
|
||||
|
||||
Object *obj = ClassDB::instance(ibt);
|
||||
|
||||
ERR_EXPLAIN("Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt));
|
||||
ERR_CONTINUE(obj == NULL);
|
||||
ERR_CONTINUE_MSG(obj == NULL, "Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt));
|
||||
|
||||
n = Object::cast_to<Node>(obj);
|
||||
n->set_script(script_res.get_ref_ptr());
|
||||
}
|
||||
|
||||
ERR_EXPLAIN("Path in autoload not a node or script: " + path);
|
||||
ERR_CONTINUE(!n);
|
||||
ERR_CONTINUE_MSG(!n, "Path in autoload not a node or script: " + path);
|
||||
n->set_name(name);
|
||||
|
||||
//defer so references are all valid on _ready()
|
||||
|
@ -1756,7 +1740,7 @@ bool Main::start() {
|
|||
|
||||
if (!project_manager && !editor) { // game
|
||||
|
||||
// Load SSL Certificates from Project Settings (or builtin)
|
||||
// Load SSL Certificates from Project Settings (or builtin).
|
||||
StreamPeerSSL::load_certs_from_memory(StreamPeerSSL::get_project_cert_array());
|
||||
|
||||
if (game_path != "") {
|
||||
|
@ -1765,8 +1749,7 @@ bool Main::start() {
|
|||
if (scenedata.is_valid())
|
||||
scene = scenedata->instance();
|
||||
|
||||
ERR_EXPLAIN("Failed loading scene: " + local_game_path);
|
||||
ERR_FAIL_COND_V(!scene, false);
|
||||
ERR_FAIL_COND_V_MSG(!scene, false, "Failed loading scene: " + local_game_path);
|
||||
sml->add_current_scene(scene);
|
||||
|
||||
#ifdef OSX_ENABLED
|
||||
|
@ -1810,14 +1793,14 @@ bool Main::start() {
|
|||
}
|
||||
|
||||
if (project_manager || editor) {
|
||||
// Load SSL Certificates from Editor Settings (or builtin)
|
||||
// Load SSL Certificates from Editor Settings (or builtin).
|
||||
String certs = EditorSettings::get_singleton()->get_setting("network/ssl/editor_ssl_certificates").operator String();
|
||||
if (certs != "")
|
||||
StreamPeerSSL::load_certs_from_file(certs);
|
||||
else
|
||||
StreamPeerSSL::load_certs_from_memory(StreamPeerSSL::get_project_cert_array());
|
||||
|
||||
// Hide console window if requested (Windows-only)
|
||||
// Hide console window if requested (Windows-only).
|
||||
bool hide_console = EditorSettings::get_singleton()->get_setting("interface/editor/hide_console_window");
|
||||
OS::get_singleton()->set_console_visible(!hide_console);
|
||||
}
|
||||
|
@ -1854,7 +1837,7 @@ bool Main::is_iterating() {
|
|||
return iterating > 0;
|
||||
}
|
||||
|
||||
// For performance metrics
|
||||
// For performance metrics.
|
||||
static uint64_t physics_process_max = 0;
|
||||
static uint64_t idle_process_max = 0;
|
||||
|
||||
|
|
|
@ -300,14 +300,11 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) {
|
|||
} break;
|
||||
default: {
|
||||
|
||||
String error = "Parser bug at " + itos(p_expr->line) + ", invalid expression type: " + itos(p_expr->type);
|
||||
ERR_EXPLAIN(error);
|
||||
ERR_FAIL_V("");
|
||||
ERR_FAIL_V_MSG("", "Parser bug at " + itos(p_expr->line) + ", invalid expression type: " + itos(p_expr->type));
|
||||
}
|
||||
}
|
||||
|
||||
return txt;
|
||||
//return "("+txt+")";
|
||||
}
|
||||
|
||||
static void _parser_show_block(const GDScriptParser::BlockNode *p_block, int p_indent) {
|
||||
|
@ -910,8 +907,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
|
|||
|
||||
if (incr == 0) {
|
||||
|
||||
ERR_EXPLAIN("unhandled opcode: " + itos(code[ip]));
|
||||
ERR_BREAK(true);
|
||||
ERR_BREAK_MSG(true, "Unhandled opcode: " + itos(code[ip]));
|
||||
}
|
||||
|
||||
ip += incr;
|
||||
|
@ -936,11 +932,7 @@ MainLoop *test(TestType p_type) {
|
|||
}
|
||||
|
||||
FileAccess *fa = FileAccess::open(test, FileAccess::READ);
|
||||
|
||||
if (!fa) {
|
||||
ERR_EXPLAIN("Could not open file: " + test);
|
||||
ERR_FAIL_V(NULL);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(!fa, NULL, "Could not open file: " + test);
|
||||
|
||||
Vector<uint8_t> buf;
|
||||
int flen = fa->get_len();
|
||||
|
|
|
@ -494,11 +494,7 @@ MainLoop *test() {
|
|||
}
|
||||
|
||||
FileAccess *fa = FileAccess::open(test, FileAccess::READ);
|
||||
|
||||
if (!fa) {
|
||||
ERR_EXPLAIN("Could not open file: " + test);
|
||||
ERR_FAIL_V(NULL);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(!fa, NULL, "Could not open file: " + test);
|
||||
|
||||
Vector<uint8_t> buf;
|
||||
int flen = fa->get_len();
|
||||
|
|
|
@ -125,8 +125,7 @@ public:
|
|||
if (full) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (OS::get_singleton()->is_stdout_verbose()) {
|
||||
ERR_EXPLAIN("Audio Ring Buffer Full (too many commands");
|
||||
ERR_FAIL_COND(((write_pos + 1) % VOICE_RB_SIZE) == read_pos);
|
||||
ERR_FAIL_COND_MSG(((write_pos + 1) % VOICE_RB_SIZE) == read_pos, "Audio ring buffer full (too many commands).");
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
|
|
|
@ -86,13 +86,9 @@ protected:
|
|||
void _unregister_shapes();
|
||||
|
||||
_FORCE_INLINE_ void _set_transform(const Transform &p_transform, bool p_update_shapes = true) {
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
|
||||
if (p_transform.origin.length_squared() > MAX_OBJECT_DISTANCE_X2) {
|
||||
ERR_EXPLAIN("Object went too far away (more than " + itos(MAX_OBJECT_DISTANCE) + "mts from origin).");
|
||||
ERR_FAIL();
|
||||
}
|
||||
ERR_FAIL_COND_MSG(p_transform.origin.length_squared() > MAX_OBJECT_DISTANCE_X2, "Object went too far away (more than " + itos(MAX_OBJECT_DISTANCE) + " units from origin).");
|
||||
#endif
|
||||
|
||||
transform = p_transform;
|
||||
|
|
|
@ -40,11 +40,8 @@
|
|||
#include "joints/pin_joint_sw.h"
|
||||
#include "joints/slider_joint_sw.h"
|
||||
|
||||
#define FLUSH_QUERY_CHECK(m_object) \
|
||||
if (m_object->get_space() && flushing_queries) { \
|
||||
ERR_EXPLAIN("Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead"); \
|
||||
ERR_FAIL(); \
|
||||
}
|
||||
#define FLUSH_QUERY_CHECK(m_object) \
|
||||
ERR_FAIL_COND_MSG(m_object->get_space() && flushing_queries, "Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead.");
|
||||
|
||||
RID PhysicsServerSW::shape_create(ShapeType p_shape) {
|
||||
|
||||
|
@ -73,8 +70,7 @@ RID PhysicsServerSW::shape_create(ShapeType p_shape) {
|
|||
} break;
|
||||
case SHAPE_CYLINDER: {
|
||||
|
||||
ERR_EXPLAIN("CylinderShape is not supported in GodotPhysics. Please switch to Bullet in the Project Settings.");
|
||||
ERR_FAIL_V(RID());
|
||||
ERR_FAIL_V_MSG(RID(), "CylinderShape is not supported in GodotPhysics. Please switch to Bullet in the Project Settings.");
|
||||
} break;
|
||||
case SHAPE_CONVEX_POLYGON: {
|
||||
|
||||
|
@ -200,11 +196,7 @@ PhysicsDirectSpaceState *PhysicsServerSW::space_get_direct_state(RID p_space) {
|
|||
|
||||
SpaceSW *space = space_owner.get(p_space);
|
||||
ERR_FAIL_COND_V(!space, NULL);
|
||||
if (!doing_sync || space->is_locked()) {
|
||||
|
||||
ERR_EXPLAIN("Space state is inaccessible right now, wait for iteration or physics process notification.");
|
||||
ERR_FAIL_V(NULL);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(!doing_sync || space->is_locked(), NULL, "Space state is inaccessible right now, wait for iteration or physics process notification.");
|
||||
|
||||
return space->get_direct_state();
|
||||
}
|
||||
|
@ -987,12 +979,7 @@ PhysicsDirectBodyState *PhysicsServerSW::body_get_direct_state(RID p_body) {
|
|||
|
||||
BodySW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND_V(!body, NULL);
|
||||
|
||||
if (!doing_sync || body->get_space()->is_locked()) {
|
||||
|
||||
ERR_EXPLAIN("Body state is inaccessible right now, wait for iteration or physics process notification.");
|
||||
ERR_FAIL_V(NULL);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(!doing_sync || body->get_space()->is_locked(), NULL, "Body state is inaccessible right now, wait for iteration or physics process notification.");
|
||||
|
||||
direct_state->body = body;
|
||||
return direct_state;
|
||||
|
@ -1410,8 +1397,7 @@ void PhysicsServerSW::free(RID p_rid) {
|
|||
|
||||
} else {
|
||||
|
||||
ERR_EXPLAIN("Invalid ID");
|
||||
ERR_FAIL();
|
||||
ERR_FAIL_MSG("Invalid ID.");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -36,11 +36,8 @@
|
|||
#include "core/project_settings.h"
|
||||
#include "core/script_language.h"
|
||||
|
||||
#define FLUSH_QUERY_CHECK(m_object) \
|
||||
if (m_object->get_space() && flushing_queries) { \
|
||||
ERR_EXPLAIN("Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead"); \
|
||||
ERR_FAIL(); \
|
||||
}
|
||||
#define FLUSH_QUERY_CHECK(m_object) \
|
||||
ERR_FAIL_COND_MSG(m_object->get_space() && flushing_queries, "Can't change this state while flushing queries. Use call_deferred() or set_deferred() to change monitoring state instead.");
|
||||
|
||||
RID Physics2DServerSW::_shape_create(ShapeType p_shape) {
|
||||
|
||||
|
@ -316,11 +313,7 @@ Physics2DDirectSpaceState *Physics2DServerSW::space_get_direct_state(RID p_space
|
|||
|
||||
Space2DSW *space = space_owner.get(p_space);
|
||||
ERR_FAIL_COND_V(!space, NULL);
|
||||
if ((using_threads && !doing_sync) || space->is_locked()) {
|
||||
|
||||
ERR_EXPLAIN("Space state is inaccessible right now, wait for iteration or physics process notification.");
|
||||
ERR_FAIL_V(NULL);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG((using_threads && !doing_sync) || space->is_locked(), NULL, "Space state is inaccessible right now, wait for iteration or physics process notification.");
|
||||
|
||||
return space->get_direct_state();
|
||||
}
|
||||
|
@ -1075,10 +1068,7 @@ int Physics2DServerSW::body_test_ray_separation(RID p_body, const Transform2D &p
|
|||
|
||||
Physics2DDirectBodyState *Physics2DServerSW::body_get_direct_state(RID p_body) {
|
||||
|
||||
if ((using_threads && !doing_sync)) {
|
||||
ERR_EXPLAIN("Body state is inaccessible right now, wait for iteration or physics process notification.");
|
||||
ERR_FAIL_V(NULL);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG((using_threads && !doing_sync), NULL, "Body state is inaccessible right now, wait for iteration or physics process notification.");
|
||||
|
||||
if (!body_owner.owns(p_body))
|
||||
return NULL;
|
||||
|
@ -1086,12 +1076,7 @@ Physics2DDirectBodyState *Physics2DServerSW::body_get_direct_state(RID p_body) {
|
|||
Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND_V(!body, NULL);
|
||||
ERR_FAIL_COND_V(!body->get_space(), NULL);
|
||||
|
||||
if (body->get_space()->is_locked()) {
|
||||
|
||||
ERR_EXPLAIN("Body state is inaccessible right now, wait for iteration or physics process notification.");
|
||||
ERR_FAIL_V(NULL);
|
||||
}
|
||||
ERR_FAIL_COND_V_MSG(body->get_space()->is_locked(), NULL, "Body state is inaccessible right now, wait for iteration or physics process notification.");
|
||||
|
||||
direct_state->body = body;
|
||||
return direct_state;
|
||||
|
@ -1321,8 +1306,7 @@ void Physics2DServerSW::free(RID p_rid) {
|
|||
|
||||
} else {
|
||||
|
||||
ERR_EXPLAIN("Invalid ID");
|
||||
ERR_FAIL();
|
||||
ERR_FAIL_MSG("Invalid ID.");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -386,8 +386,7 @@ void VisualServerCanvas::canvas_item_set_parent(RID p_item, RID p_parent) {
|
|||
|
||||
} else {
|
||||
|
||||
ERR_EXPLAIN("Invalid parent");
|
||||
ERR_FAIL();
|
||||
ERR_FAIL_MSG("Invalid parent.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -754,12 +753,7 @@ void VisualServerCanvas::canvas_item_add_polygon(RID p_item, const Vector<Point2
|
|||
ERR_FAIL_COND(uv_size != 0 && (uv_size != pointcount));
|
||||
#endif
|
||||
Vector<int> indices = Geometry::triangulate_polygon(p_points);
|
||||
|
||||
if (indices.empty()) {
|
||||
|
||||
ERR_EXPLAIN("Bad Polygon!");
|
||||
ERR_FAIL();
|
||||
}
|
||||
ERR_FAIL_COND_MSG(indices.empty(), "Invalid polygon data, triangulation failed.");
|
||||
|
||||
Item::CommandPolygon *polygon = memnew(Item::CommandPolygon);
|
||||
ERR_FAIL_COND(!polygon);
|
||||
|
|
|
@ -1145,11 +1145,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim
|
|||
Vector<AABB> bone_aabb;
|
||||
|
||||
Error err = _surface_set_data(p_arrays, format, offsets, total_elem_size, vertex_array, array_len, index_array, index_array_len, aabb, bone_aabb);
|
||||
|
||||
if (err) {
|
||||
ERR_EXPLAIN("Invalid array format for surface");
|
||||
ERR_FAIL();
|
||||
}
|
||||
ERR_FAIL_COND_MSG(err, "Invalid array format for surface.");
|
||||
|
||||
Vector<PoolVector<uint8_t> > blend_shape_data;
|
||||
|
||||
|
@ -1162,10 +1158,7 @@ void VisualServer::mesh_add_surface_from_arrays(RID p_mesh, PrimitiveType p_prim
|
|||
AABB laabb;
|
||||
Error err2 = _surface_set_data(p_blend_shapes[i], format & ~ARRAY_FORMAT_INDEX, offsets, total_elem_size, vertex_array_shape, array_len, noindex, 0, laabb, bone_aabb);
|
||||
aabb.merge_with(laabb);
|
||||
if (err2 != OK) {
|
||||
ERR_EXPLAIN("Invalid blend shape array format for surface");
|
||||
ERR_FAIL();
|
||||
}
|
||||
ERR_FAIL_COND_MSG(err2 != OK, "Invalid blend shape array format for surface.");
|
||||
|
||||
blend_shape_data.push_back(vertex_array_shape);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue