Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit c7147aa

Browse files
committed
Throw conversion error for other types
1 parent a6f5874 commit c7147aa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/include/type/value_factory.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ class ValueFactory {
206206
} catch (std::out_of_range &e) {
207207
throw Exception(ExceptionType::OUT_OF_RANGE,
208208
"Numeric value out of range.");
209+
} catch(std::invalid_argument &e) {
210+
throw Exception("Invalid input syntax for bigint: \'" + str + "\'");
209211
}
210212
if (bigint > PELOTON_INT64_MAX || bigint < PELOTON_INT64_MIN)
211213
throw Exception(ExceptionType::OUT_OF_RANGE,
@@ -312,6 +314,8 @@ class ValueFactory {
312314
} catch (std::out_of_range &e) {
313315
throw Exception(ExceptionType::OUT_OF_RANGE,
314316
"Numeric value out of range.");
317+
} catch(std::invalid_argument &e) {
318+
throw Exception("Invalid input syntax for smallint: \'" + str + "\'");
315319
}
316320
if (smallint < PELOTON_INT16_MIN)
317321
throw Exception(ExceptionType::OUT_OF_RANGE,
@@ -370,6 +374,8 @@ class ValueFactory {
370374
} catch (std::out_of_range &e) {
371375
throw Exception(ExceptionType::OUT_OF_RANGE,
372376
"Numeric value out of range.");
377+
} catch(std::invalid_argument &e) {
378+
throw Exception("Invalid input syntax for tinyint: \'" + str + "\'");
373379
}
374380
if (tinyint < PELOTON_INT8_MIN)
375381
throw Exception(ExceptionType::OUT_OF_RANGE,
@@ -408,6 +414,8 @@ class ValueFactory {
408414
} catch (std::out_of_range &e) {
409415
throw Exception(ExceptionType::OUT_OF_RANGE,
410416
"Numeric value out of range.");
417+
} catch(std::invalid_argument &e) {
418+
throw Exception("Invalid input syntax for decimal: \'" + str + "\'");
411419
}
412420
if (res > PELOTON_DECIMAL_MAX || res < PELOTON_DECIMAL_MIN)
413421
throw Exception(ExceptionType::OUT_OF_RANGE,

0 commit comments

Comments
 (0)