mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00
api_set_error(): rename
This commit is contained in:
@@ -171,7 +171,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id,
|
||||
end = normalize_index(buf, end, &oob);
|
||||
|
||||
if (strict_indexing && oob) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Index out of bounds"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Index out of bounds"));
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ ArrayOf(String) nvim_buf_get_lines(uint64_t channel_id,
|
||||
int64_t lnum = start + (int64_t)i;
|
||||
|
||||
if (lnum > LONG_MAX) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Line index is too high"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Line index is too high"));
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -283,13 +283,13 @@ void nvim_buf_set_lines(uint64_t channel_id,
|
||||
end = normalize_index(buf, end, &oob);
|
||||
|
||||
if (strict_indexing && oob) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Index out of bounds"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Index out of bounds"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (start > end) {
|
||||
_api_set_error(err,
|
||||
api_set_error(err,
|
||||
kErrorTypeValidation,
|
||||
_("Argument \"start\" is higher than \"end\""));
|
||||
return;
|
||||
@@ -304,7 +304,7 @@ void nvim_buf_set_lines(uint64_t channel_id,
|
||||
|
||||
for (size_t i = 0; i < new_len; i++) {
|
||||
if (replacement.items[i].type != kObjectTypeString) {
|
||||
_api_set_error(err,
|
||||
api_set_error(err,
|
||||
kErrorTypeValidation,
|
||||
_("All items in the replacement array must be strings"));
|
||||
goto end;
|
||||
@@ -317,7 +317,7 @@ void nvim_buf_set_lines(uint64_t channel_id,
|
||||
lines[i] = xmallocz(l.size);
|
||||
for (size_t j = 0; j < l.size; j++) {
|
||||
if (l.data[j] == '\n' && channel_id != INTERNAL_CALL) {
|
||||
_api_set_error(err, kErrorTypeException, _("string cannot contain newlines"));
|
||||
api_set_error(err, kErrorTypeException, _("string cannot contain newlines"));
|
||||
new_len = i + 1;
|
||||
goto end;
|
||||
}
|
||||
@@ -330,7 +330,7 @@ void nvim_buf_set_lines(uint64_t channel_id,
|
||||
switch_to_win_for_buf(buf, &save_curwin, &save_curtab, &save_curbuf);
|
||||
|
||||
if (u_save((linenr_T)(start - 1), (linenr_T)end) == FAIL) {
|
||||
_api_set_error(err, kErrorTypeException, _("Failed to save undo information"));
|
||||
api_set_error(err, kErrorTypeException, _("Failed to save undo information"));
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ void nvim_buf_set_lines(uint64_t channel_id,
|
||||
size_t to_delete = (new_len < old_len) ? (size_t)(old_len - new_len) : 0;
|
||||
for (size_t i = 0; i < to_delete; i++) {
|
||||
if (ml_delete((linenr_T)start, false) == FAIL) {
|
||||
_api_set_error(err, kErrorTypeException, _("Failed to delete line"));
|
||||
api_set_error(err, kErrorTypeException, _("Failed to delete line"));
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
@@ -357,12 +357,12 @@ void nvim_buf_set_lines(uint64_t channel_id,
|
||||
int64_t lnum = start + (int64_t)i;
|
||||
|
||||
if (lnum > LONG_MAX) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Index value is too high"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Index value is too high"));
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (ml_replace((linenr_T)lnum, (char_u *)lines[i], false) == FAIL) {
|
||||
_api_set_error(err, kErrorTypeException, _("Failed to replace line"));
|
||||
api_set_error(err, kErrorTypeException, _("Failed to replace line"));
|
||||
goto end;
|
||||
}
|
||||
// Mark lines that haven't been passed to the buffer as they need
|
||||
@@ -375,12 +375,12 @@ void nvim_buf_set_lines(uint64_t channel_id,
|
||||
int64_t lnum = start + (int64_t)i - 1;
|
||||
|
||||
if (lnum > LONG_MAX) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Index value is too high"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Index value is too high"));
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (ml_append((linenr_T)lnum, (char_u *)lines[i], 0, false) == FAIL) {
|
||||
_api_set_error(err, kErrorTypeException, _("Failed to insert line"));
|
||||
api_set_error(err, kErrorTypeException, _("Failed to insert line"));
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -627,7 +627,7 @@ void nvim_buf_set_name(Buffer buffer, String name, Error *err)
|
||||
}
|
||||
|
||||
if (ren_ret == FAIL) {
|
||||
_api_set_error(err, kErrorTypeException, _("Failed to rename buffer"));
|
||||
api_set_error(err, kErrorTypeException, _("Failed to rename buffer"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -680,7 +680,7 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err)
|
||||
}
|
||||
|
||||
if (name.size != 1) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Mark name must be a single character"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Mark name must be a single character"));
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -698,7 +698,7 @@ ArrayOf(Integer, 2) nvim_buf_get_mark(Buffer buffer, String name, Error *err)
|
||||
}
|
||||
|
||||
if (posp == NULL) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Invalid mark name"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Invalid mark name"));
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -753,11 +753,11 @@ Integer nvim_buf_add_highlight(Buffer buffer,
|
||||
}
|
||||
|
||||
if (line < 0 || line >= MAXLNUM) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Line number outside range"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Line number outside range"));
|
||||
return 0;
|
||||
}
|
||||
if (col_start < 0 || col_start > MAXCOL) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Column value outside range"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Column value outside range"));
|
||||
return 0;
|
||||
}
|
||||
if (col_end < 0 || col_end > MAXCOL) {
|
||||
@@ -794,7 +794,7 @@ void nvim_buf_clear_highlight(Buffer buffer,
|
||||
}
|
||||
|
||||
if (line_start < 0 || line_start >= MAXLNUM) {
|
||||
_api_set_error(err, kErrorTypeValidation, _("Line number outside range"));
|
||||
api_set_error(err, kErrorTypeValidation, _("Line number outside range"));
|
||||
return;
|
||||
}
|
||||
if (line_end < 0 || line_end > MAXLNUM) {
|
||||
|
Reference in New Issue
Block a user