Skip to content

measurements --types: invalid codes return Withings 503 'Invalid Params' instead of friendly error #24

@DTTerastar

Description

@DTTerastar

Severity

minor

Summary

measurements --types accepts any string and forwards it verbatim to the Withings API. Non-numeric input bubbles up as an unhelpful HTTP-503-shaped error; unknown numeric codes silently return an empty result.

Reproduce

$ withings-export measurements --types abc --since 7d
Error: withings API status 503: Invalid Params
Usage:
  withings-export measurements [flags]
  ...

$ withings-export measurements --types 999 --since 30d --json
null

Expected

  • Validate --types is a comma-separated list of positive integers locally before calling the API; on bad input, error with invalid --types value "abc": expected comma-separated integers (e.g. 1,6,76).
  • For unknown but well-formed codes, follow the contract: empty [], exit 0. (Right now the empty case is null — duplicate of Empty JSON output is 'null' instead of '[]' — breaks jq pipelines #16, but worth confirming the same fix covers it.)
  • The Withings 503 wrap is also misleading — Withings returns HTTP 200 with a non-zero status code in the body; the CLI is rendering that body status as if it were an HTTP status. Render as e.g. withings API error 503: Invalid Params without status.

Metadata

Metadata

Assignees

Labels

area:format--format markdown/json/csv and codec behavior.kind:bugObserved behavior diverges from documented behavior.priority:mediumReproducible bug or gap with a workaround, or a well-scoped enhancement clearly in charter.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions