Skip to content

Commit 30a198e

Browse files
committed
refine error messages
1 parent 51fc1da commit 30a198e

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

libsql-sqlite3/src/vector.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -266,28 +266,28 @@ static int vectorParseMeta(const unsigned char *pBlob, size_t nBlobSize, int *pT
266266

267267
if( *pType == VECTOR_TYPE_FLOAT32 ){
268268
if( nBlobSize % 4 != 0 ){
269-
*pzErrMsg = sqlite3_mprintf("invalid vector: f32 vector blob length must be divisible by 4 (excluding optional 'type'-byte): length=%d", nBlobSize);
269+
*pzErrMsg = sqlite3_mprintf("vector: f32 vector blob length must be divisible by 4 (excluding optional 'type'-byte): length=%d", nBlobSize);
270270
return SQLITE_ERROR;
271271
}
272272
*pDims = nBlobSize / sizeof(float);
273273
*pDataSize = nBlobSize;
274274
}else if( *pType == VECTOR_TYPE_FLOAT64 ){
275275
if( nBlobSize % 8 != 0 ){
276-
*pzErrMsg = sqlite3_mprintf("invalid vector: f64 vector blob length must be divisible by 8 (excluding 'type'-byte): length=%d", nBlobSize);
276+
*pzErrMsg = sqlite3_mprintf("vector: f64 vector blob length must be divisible by 8 (excluding 'type'-byte): length=%d", nBlobSize);
277277
return SQLITE_ERROR;
278278
}
279279
*pDims = nBlobSize / sizeof(double);
280280
*pDataSize = nBlobSize;
281281
}else if( *pType == VECTOR_TYPE_1BIT ){
282282
if( nBlobSize == 0 || nBlobSize % 2 != 0 ){
283-
*pzErrMsg = sqlite3_mprintf("invalid vector: 1bit vector blob length must be divisible by 2 and not be empty (excluding 'type'-byte): length=%d", nBlobSize);
283+
*pzErrMsg = sqlite3_mprintf("vector: 1bit vector blob length must be divisible by 2 and not be empty (excluding 'type'-byte): length=%d", nBlobSize);
284284
return SQLITE_ERROR;
285285
}
286286
nLeftoverBits = pBlob[nBlobSize - 1];
287287
*pDims = nBlobSize * 8 - nLeftoverBits;
288288
*pDataSize = (*pDims + 7) / 8;
289289
}else{
290-
*pzErrMsg = sqlite3_mprintf("invalid vector: unexpected type: %d", *pType);
290+
*pzErrMsg = sqlite3_mprintf("vector: unexpected binary type: %d", *pType);
291291
return SQLITE_ERROR;
292292
}
293293
return SQLITE_OK;
@@ -312,7 +312,7 @@ int vectorParseSqliteBlobWithType(
312312

313313
if( nDataSize != vectorDataSize(pVector->type, pVector->dims) ){
314314
*pzErrMsg = sqlite3_mprintf(
315-
"invalid vector: unexpected data size bytes: type=%d, dims=%d, %ull != %ull",
315+
"vector: unexpected data part size: type=%d, dims=%d, %ull != %ull",
316316
pVector->type,
317317
pVector->dims,
318318
nDataSize,

libsql-sqlite3/test/libsql_vector.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ do_test vector-1-func-errors {
137137
{vector: invalid float at position 0: '[1'}
138138
{vector: invalid float at position 2: '1.1.1'}
139139
{vector: must end with ']'}
140-
{invalid vector: unexpected type: 0}
140+
{vector: unexpected binary type: 0}
141141
{vector_distance_cos: vectors must have the same length: 3 != 2}
142142
{vector_distance_cos: vectors must have the same type: 1 != 2}
143143
}]

libsql-sqlite3/test/libsql_vector_index.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ do_execsql_test vector-partial {
327327
2 3 5 6 8 9
328328
}
329329

330-
do_execsql_test vector-1bit-table {
330+
do_execsql_test vector-1bit-index {
331331
CREATE TABLE t_1bit_table( v FLOAT1BIT(4) );
332332
INSERT INTO t_1bit_table VALUES ( vector1bit('[1,-1,1,-1]') );
333333
CREATE INDEX t_1bit_table_idx ON t_1bit_table( libsql_vector_idx(v) );

0 commit comments

Comments
 (0)