Skip to content

Wrong Error message for folate #245

@elmryn-motu

Description

@elmryn-motu

Describe the bug
When trying to save folate, it is saved correct.
But when I try to save too much folate as a nutrition record I get the following error message:
java.lang.IllegalArgumentException: chloride must not be more than 100.0 grams when trying to save folate

Im not sure if this is a problem regarding this project or on androids side, but this is where I found the valid ranges for nutrition record values, e.g. folate:
/** Folate in [Mass] unit. Optional field. Valid range: 0-100 grams. */

To Reproduce
Try to save folate as nutrition record(minimal reproducible below).

Expected behavior
Throwing an error for folate, not chloride

Screenshots

  • not needed here(I think)

Minimal Reproducible

await insertRecords([
  {
    recordType: 'Nutrition',
    name: 'folateTest',
    folate: {
      value: 10,
      unit: 'grams',
    },
    startTime: (d => new Date(d.setDate(d.getDate() - 1)))(new Date()).toISOString(),//yesterday
    endTime: new Date().toISOString(),
    mealType: 1, // BREAKFAST
  }
]);

Environment:

  • Health Connect Version: 3.5.0
  • React Native Version: 0.81.4
  • New architecture enabled: Yes
  • Using Expo: No
  • Android API Level: e.g API 34 (Android 14)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions