File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ template <> struct string_traits<pgvector::SparseVector> {
133133
134134 int dimensions = std::stoi (std::string (text.substr (n + 2 )));
135135 if (dimensions < 0 ) {
136- throw conversion_error (" Malformed sparsevec literal " );
136+ throw conversion_error (" Dimensions cannot be negative " );
137137 }
138138
139139 std::vector<int > indices;
@@ -154,7 +154,7 @@ template <> struct string_traits<pgvector::SparseVector> {
154154 float value = std::stof (substr.substr (ne + 1 ));
155155
156156 if (index < 1 ) {
157- throw conversion_error (" Malformed sparsevec literal " );
157+ throw conversion_error (" Index out of bounds " );
158158 }
159159
160160 indices.push_back (index - 1 );
Original file line number Diff line number Diff line change @@ -252,7 +252,7 @@ void test_sparsevec_from_string() {
252252 auto unused = pqxx::from_string<pgvector::SparseVector>(" {}/-1" );
253253 assert (false );
254254 } catch (const pqxx::conversion_error& e) {
255- assert (std::string_view (e.what ()) == " Malformed sparsevec literal " );
255+ assert (std::string_view (e.what ()) == " Dimensions cannot be negative " );
256256 }
257257
258258 try {
@@ -273,14 +273,14 @@ void test_sparsevec_from_string() {
273273 auto unused = pqxx::from_string<pgvector::SparseVector>(" {0:1}/1" );
274274 assert (false );
275275 } catch (const pqxx::conversion_error& e) {
276- assert (std::string_view (e.what ()) == " Malformed sparsevec literal " );
276+ assert (std::string_view (e.what ()) == " Index out of bounds " );
277277 }
278278
279279 try {
280280 auto unused = pqxx::from_string<pgvector::SparseVector>(" {-2147483648:1}/1" );
281281 assert (false );
282282 } catch (const pqxx::conversion_error& e) {
283- assert (std::string_view (e.what ()) == " Malformed sparsevec literal " );
283+ assert (std::string_view (e.what ()) == " Index out of bounds " );
284284 }
285285
286286 try {
You can’t perform that action at this time.
0 commit comments