-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add range error validation for datatypes #1594
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1594 +/- ##
===========================================
- Coverage 78.24% 66.05% -12.19%
===========================================
Files 93 93
Lines 4821 4858 +37
Branches 921 932 +11
===========================================
- Hits 3772 3209 -563
- Misses 750 1245 +495
- Partials 299 404 +105 ☔ View full report in Codecov by Sentry. |
} | ||
|
||
if (value < MIN_DATE || value > MAX_DATE) { | ||
throw new TypeError('Out of range.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be RangeError
instead? 🤔
src/data-types/date.ts
Outdated
@@ -1,12 +1,18 @@ | |||
import { type DataType } from '../data-type'; | |||
import { ChronoUnit, LocalDate } from '@js-joda/core'; | |||
import { type InternalConnectionOptions } from '../connection'; | |||
|
|||
import { Collation } from '../collation'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work? 🤔
import { Collation } from '../collation'; | |
import { type Collation } from '../collation'; |
…usjs/tedious into michael-DatatypeRangeCheck
🎉 This PR is included in version 16.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
* chore: add range error validation for date types * add validation tests for numbers * remove only * add money validation * chore: remove un-needed types --------- Co-authored-by: mShan0 <96149598+mShan0@users.noreply.github.com> (cherry picked from commit 19cb073)
Add range error check for datatypes:
Adds validate tests for datatypes:
Referenced the changes from this PR: #1271 : fix: out-of-range date error handle
Referenced the changes from PR #815 for money validation