Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions c/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@

(:user:`benjeffery`, :issue:`1720`, :pr:`2226`, :pr:`2229`, :pr:`2224`)

- Remove the generic ``TSK_ERR_OUT_OF_BOUNDS`` - replacing with specific errors.
Remove ``TSK_ERR_NON_SINGLE_CHAR_MUTATION`` which was unused.
(:user:`benjeffery`, :pr:`2260`)


**Features**

- Make dumping of tables and tree sequences to disk a zero-copy operation.
Expand Down
6 changes: 3 additions & 3 deletions c/tests/test_genotypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,12 +575,12 @@ test_single_tree_errors(void)

samples[0] = -1;
ret = tsk_vargen_init(&vargen, &ts, samples, 2, NULL, 0);
CU_ASSERT_EQUAL_FATAL(ret, TSK_ERR_OUT_OF_BOUNDS);
CU_ASSERT_EQUAL_FATAL(ret, TSK_ERR_NODE_OUT_OF_BOUNDS);
tsk_vargen_free(&vargen);

samples[0] = 7;
ret = tsk_vargen_init(&vargen, &ts, samples, 2, NULL, 0);
CU_ASSERT_EQUAL_FATAL(ret, TSK_ERR_OUT_OF_BOUNDS);
CU_ASSERT_EQUAL_FATAL(ret, TSK_ERR_NODE_OUT_OF_BOUNDS);
tsk_vargen_free(&vargen);

samples[0] = 3;
Expand Down Expand Up @@ -945,7 +945,7 @@ test_variant_decode_errors(void)

/* Bad samples */
ret = tsk_variant_init(&var, &ts, bad_samples, 3, NULL, 0);
CU_ASSERT_EQUAL_FATAL(ret, TSK_ERR_OUT_OF_BOUNDS);
CU_ASSERT_EQUAL_FATAL(ret, TSK_ERR_NODE_OUT_OF_BOUNDS);
tsk_variant_free(&var);

/* Site out of bounds */
Expand Down
4 changes: 2 additions & 2 deletions c/tests/test_haplotype_matching.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,9 @@ test_single_tree_errors(void)
forward.tree_sequence = &ts;

ret = tsk_compressed_matrix_store_site(&forward, 3, 0, 0, NULL);
CU_ASSERT_EQUAL_FATAL(ret, TSK_ERR_OUT_OF_BOUNDS);
CU_ASSERT_EQUAL_FATAL(ret, TSK_ERR_SITE_OUT_OF_BOUNDS);
ret = tsk_compressed_matrix_store_site(&forward, 4, 0, 0, NULL);
CU_ASSERT_EQUAL_FATAL(ret, TSK_ERR_OUT_OF_BOUNDS);
CU_ASSERT_EQUAL_FATAL(ret, TSK_ERR_SITE_OUT_OF_BOUNDS);

T[0].tree_node = -1;
T[0].value = 0;
Expand Down
29 changes: 14 additions & 15 deletions c/tskit/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,6 @@ tsk_strerror_internal(int err)
case TSK_ERR_BAD_OFFSET:
ret = "Bad offset provided in input array";
break;
case TSK_ERR_OUT_OF_BOUNDS:
ret = "Object reference out of bounds";
break;
case TSK_ERR_NODE_OUT_OF_BOUNDS:
ret = "Node out of bounds";
break;
Expand Down Expand Up @@ -338,7 +335,7 @@ tsk_strerror_internal(int err)
ret = "Table too large; cannot allocate more than 2**31 rows.";
break;
case TSK_ERR_COLUMN_OVERFLOW:
ret = "Table column too large; cannot be more than 2**32 bytes.";
ret = "Table column too large; cannot be more than 2**64 bytes.";
break;
case TSK_ERR_TREE_OVERFLOW:
ret = "Too many trees; cannot be more than 2**31.";
Expand All @@ -349,17 +346,15 @@ tsk_strerror_internal(int err)

/* Limitations */
case TSK_ERR_ONLY_INFINITE_SITES:
ret = "Only infinite sites mutations are supported for this operation";
ret = "Only infinite sites mutations are supported for this operation, "
"i.e. at most a single mutation per site.";
break;
case TSK_ERR_SIMPLIFY_MIGRATIONS_NOT_SUPPORTED:
ret = "Migrations not currently supported by simplify";
break;
case TSK_ERR_SORT_MIGRATIONS_NOT_SUPPORTED:
ret = "Migrations not currently supported by sort";
break;
case TSK_ERR_MIGRATIONS_NOT_SUPPORTED:
ret = "Migrations not currently supported by this operation";
break;
case TSK_ERR_SORT_OFFSET_NOT_SUPPORTED:
ret = "Sort offsets for sites and mutations must be either 0 "
"or the length of the respective tables. Intermediate values "
Expand All @@ -368,6 +363,9 @@ tsk_strerror_internal(int err)
case TSK_ERR_NONBINARY_MUTATIONS_UNSUPPORTED:
ret = "Only binary mutations are supported for this operation";
break;
case TSK_ERR_MIGRATIONS_NOT_SUPPORTED:
ret = "Migrations not currently supported by this operation";
break;
case TSK_ERR_CANNOT_EXTEND_FROM_SELF:
ret = "Tables can only be extended using rows from a different table";
break;
Expand Down Expand Up @@ -430,19 +428,19 @@ tsk_strerror_internal(int err)
break;

/* Genotype decoding errors */
case TSK_ERR_TOO_MANY_ALLELES:
ret = "Cannot have more than 127 alleles";
break;
case TSK_ERR_ZERO_ALLELES:
ret = "Must have at least one allele when specifying an allele map";
break;
case TSK_ERR_MUST_IMPUTE_NON_SAMPLES:
ret = "Cannot generate genotypes for non-samples when isolated nodes are "
"considered as missing";
break;
case TSK_ERR_ALLELE_NOT_FOUND:
ret = "An allele was not found in the user-specified allele map";
break;
case TSK_ERR_TOO_MANY_ALLELES:
ret = "Cannot have more than 2147483647 alleles";
break;
case TSK_ERR_ZERO_ALLELES:
ret = "Must have at least one allele when specifying an allele map";
break;

/* Distance metric errors */
case TSK_ERR_SAMPLE_SIZE_MISMATCH:
Expand Down Expand Up @@ -508,7 +506,8 @@ tsk_strerror_internal(int err)

/* Simplify errors */
case TSK_ERR_KEEP_UNARY_MUTUALLY_EXCLUSIVE:
ret = "You cannot specify both KEEP_UNARY and KEEP_UNARY_IN_INDIVDUALS.";
ret = "You cannot specify both TSK_SIMPLIFY_KEEP_UNARY and "
"TSK_SIMPLIFY_KEEP_UNARY_IN_INDIVDUALS.";
break;

/* Individual errors */
Expand Down
Loading