@@ -214,10 +214,12 @@ class ValueFactory {
214
214
std::string str = value.ToString ();
215
215
int64_t bigint = 0 ;
216
216
try {
217
- bigint = std:: stoll (str);
217
+ bigint = stoll (str);
218
218
} catch (std::out_of_range &e) {
219
219
throw Exception (ExceptionType::OUT_OF_RANGE,
220
220
" Numeric value out of range." );
221
+ } catch (std::invalid_argument &e) {
222
+ throw Exception (" Invalid input syntax for bigint: \' " + str + " \' " );
221
223
}
222
224
if (bigint > PELOTON_INT64_MAX || bigint < PELOTON_INT64_MIN)
223
225
throw Exception (ExceptionType::OUT_OF_RANGE,
@@ -262,11 +264,14 @@ class ValueFactory {
262
264
std::string str = value.ToString ();
263
265
int32_t integer = 0 ;
264
266
try {
265
- integer = std:: stoi (str);
267
+ integer = stoi (str);
266
268
} catch (std::out_of_range &e) {
267
269
throw Exception (ExceptionType::OUT_OF_RANGE,
268
270
" Numeric value out of range." );
271
+ } catch (std::invalid_argument &e) {
272
+ throw Exception (" Invalid input syntax for integer: \' " + str + " \' " );
269
273
}
274
+
270
275
if (integer > PELOTON_INT32_MAX || integer < PELOTON_INT32_MIN)
271
276
throw Exception (ExceptionType::OUT_OF_RANGE,
272
277
" Numeric value out of range." );
@@ -317,10 +322,12 @@ class ValueFactory {
317
322
std::string str = value.ToString ();
318
323
int16_t smallint = 0 ;
319
324
try {
320
- smallint = std:: stoi (str);
325
+ smallint = stoi (str);
321
326
} catch (std::out_of_range &e) {
322
327
throw Exception (ExceptionType::OUT_OF_RANGE,
323
328
" Numeric value out of range." );
329
+ } catch (std::invalid_argument &e) {
330
+ throw Exception (" Invalid input syntax for smallint: \' " + str + " \' " );
324
331
}
325
332
if (smallint < PELOTON_INT16_MIN)
326
333
throw Exception (ExceptionType::OUT_OF_RANGE,
@@ -375,10 +382,12 @@ class ValueFactory {
375
382
std::string str = value.ToString ();
376
383
int8_t tinyint = 0 ;
377
384
try {
378
- tinyint = std:: stoi (str);
385
+ tinyint = stoi (str);
379
386
} catch (std::out_of_range &e) {
380
387
throw Exception (ExceptionType::OUT_OF_RANGE,
381
388
" Numeric value out of range." );
389
+ } catch (std::invalid_argument &e) {
390
+ throw Exception (" Invalid input syntax for tinyint: \' " + str + " \' " );
382
391
}
383
392
if (tinyint < PELOTON_INT8_MIN)
384
393
throw Exception (ExceptionType::OUT_OF_RANGE,
@@ -413,10 +422,12 @@ class ValueFactory {
413
422
std::string str = value.ToString ();
414
423
double res = 0 ;
415
424
try {
416
- res = std:: stod (str);
425
+ res = stod (str);
417
426
} catch (std::out_of_range &e) {
418
427
throw Exception (ExceptionType::OUT_OF_RANGE,
419
428
" Numeric value out of range." );
429
+ } catch (std::invalid_argument &e) {
430
+ throw Exception (" Invalid input syntax for decimal: \' " + str + " \' " );
420
431
}
421
432
if (res > PELOTON_DECIMAL_MAX || res < PELOTON_DECIMAL_MIN)
422
433
throw Exception (ExceptionType::OUT_OF_RANGE,
0 commit comments