api: Do not truncate errors <1 MB. #6237

Closes #5984
This commit is contained in:
Sander Bosma
2017-03-01 10:43:47 +01:00
committed by Justin M. Keyes
parent 4524053874
commit 5c9860a0a2
15 changed files with 209 additions and 172 deletions

View File

@@ -64,8 +64,8 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
if (pos.size != 2 || pos.items[0].type != kObjectTypeInteger
|| pos.items[1].type != kObjectTypeInteger) {
api_set_error(err,
Validation,
_api_set_error(err,
kErrorTypeValidation,
_("Argument \"pos\" must be a [row, col] array"));
return;
}
@@ -78,12 +78,12 @@ void nvim_win_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err)
int64_t col = pos.items[1].data.integer;
if (row <= 0 || row > win->w_buffer->b_ml.ml_line_count) {
api_set_error(err, Validation, _("Cursor position outside buffer"));
_api_set_error(err, kErrorTypeValidation, _("Cursor position outside buffer"));
return;
}
if (col > MAXCOL || col < 0) {
api_set_error(err, Validation, _("Column value outside range"));
_api_set_error(err, kErrorTypeValidation, _("Column value outside range"));
return;
}
@@ -132,7 +132,7 @@ void nvim_win_set_height(Window window, Integer height, Error *err)
}
if (height > INT_MAX || height < INT_MIN) {
api_set_error(err, Validation, _("Height value outside range"));
_api_set_error(err, kErrorTypeValidation, _("Height value outside range"));
return;
}
@@ -177,7 +177,7 @@ void nvim_win_set_width(Window window, Integer width, Error *err)
}
if (width > INT_MAX || width < INT_MIN) {
api_set_error(err, Validation, _("Width value outside range"));
_api_set_error(err, kErrorTypeValidation, _("Width value outside range"));
return;
}
@@ -387,6 +387,8 @@ Boolean nvim_win_is_valid(Window window)
FUNC_API_SINCE(1)
{
Error stub = ERROR_INIT;
return find_window_by_handle(window, &stub) != NULL;
Boolean ret = find_window_by_handle(window, &stub) != NULL;
xfree(stub.msg);
return ret;
}