mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-25 11:49:53 -05:00
### Does this PR have any customer impact?
### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
### Are you introducing any new config? If yes, do you have tests with and without them being set?
### Release Note (Refer [Template](../docs/release_notes/pgmongo_template.md))
### Description
the PR to fix js error of date_from_string_on_error.js
fix case, when onError is provided and dateSring is invalid ,need to throw onError.
example:
dateString is 5, should throw onError.
`db.date_from_string_on_error.aggregate([
{
$project: {
date: {
$dateFromString: {
dateString: 5,
format:null,
onError: ISODate("2017-07-04T11:56:02Z")
}
}
}
}]);`
----
#### AI description (iteration 1)
#### PR Classification
Bug fix
#### PR Summary
This pull request addresses a corner case in the `date_from_string_on_error.js` test by improving error handling in date parsing functions.
- `src/operators/bson_expression_date_operators.c`: Added checks for `isOnErrorProvided` to handle cases where `onError` is specified, ensuring proper error handling and result setting.
- Modified several functions to include the `isOnErrorProvided` parameter to improve error handling logic.