diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-08-09 12:40:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-09 12:40:05 +0200 |
commit | 3ea33c0e455f5e52b73ae5da51d0000e8decef7b (patch) | |
tree | 674a28d2d3e4f83bd53d72e07d1ba8327c6f1c99 /modules/mono/editor/script_class_parser.cpp | |
parent | 80c7cb63783414daba5a5ef84085bbb3c6f1ff15 (diff) | |
parent | c55ce204b3065d55df2717a7e0bcb0681392ac34 (diff) | |
download | redot-engine-3ea33c0e455f5e52b73ae5da51d0000e8decef7b.tar.gz |
Merge pull request #31221 from neikeq/err-explain-to-msg-mono
Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'modules/mono'
Diffstat (limited to 'modules/mono/editor/script_class_parser.cpp')
-rw-r--r-- | modules/mono/editor/script_class_parser.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/mono/editor/script_class_parser.cpp b/modules/mono/editor/script_class_parser.cpp index dfb652a7aa..dcb0ca5a80 100644 --- a/modules/mono/editor/script_class_parser.cpp +++ b/modules/mono/editor/script_class_parser.cpp @@ -162,8 +162,8 @@ ScriptClassParser::Token ScriptClassParser::get_token() { error = true; return TK_ERROR; } else if (code[idx] == begin_str) { - if (verbatim && code[idx + 1] == '"') { // `""` is verbatim string's `\"` - idx += 2; // skip next `"` as well + if (verbatim && code[idx + 1] == '"') { // '""' is verbatim string's '\"' + idx += 2; // skip next '"' as well continue; } @@ -590,7 +590,7 @@ Error ScriptClassParser::parse(const String &p_code) { name = String(value); } else if (tk == TK_CURLY_BRACKET_OPEN) { if (name.empty()) { - error_str = "Expected " + get_token_name(TK_IDENTIFIER) + " after keyword `struct`, found " + get_token_name(TK_CURLY_BRACKET_OPEN); + error_str = "Expected " + get_token_name(TK_IDENTIFIER) + " after keyword 'struct', found " + get_token_name(TK_CURLY_BRACKET_OPEN); error = true; return ERR_PARSE_ERROR; } @@ -657,12 +657,12 @@ Error ScriptClassParser::parse_file(const String &p_filepath) { String source; Error ferr = read_all_file_utf8(p_filepath, source); - if (ferr != OK) { - if (ferr == ERR_INVALID_DATA) { - ERR_EXPLAIN("File '" + p_filepath + "' contains invalid unicode (utf-8), so it was not loaded. Please ensure that scripts are saved in valid utf-8 unicode."); - } - ERR_FAIL_V(ferr); - } + + ERR_FAIL_COND_V_MSG(ferr != OK, ferr, + ferr == ERR_INVALID_DATA ? + "File '" + p_filepath + "' contains invalid unicode (UTF-8), so it was not loaded." + " Please ensure that scripts are saved in valid UTF-8 unicode." : + "Failed to read file: '" + p_filepath + "'."); return parse(source); } |