Skip to content

[Reliability] Add fallbacks for known Product variation decoding errors #9838

@rachelmcr

Description

@rachelmcr

For better resilience to unexpected data when requesting product variations from the API, we should add fallbacks for the following known Swift.DecodingError.typeMismatch errors:

  • dimensions.length:
Swift.DecodingError.typeMismatch(Swift.String, Swift.DecodingError.Context(codingPath: [_JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "dimensions", intValue: nil), CodingKeys(stringValue: "length", intValue: nil)], debugDescription: "Expected to decode String but found a number instead.", underlyingError: nil))
  • permalink:
Swift.DecodingError.typeMismatch(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "data", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "permalink", intValue: nil)], debugDescription: "Expected to decode String but found a number instead.", underlyingError: nil))
  • regular_price:
Swift.DecodingError.typeMismatch(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "data", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "regular_price", intValue: nil)], debugDescription: "Expected to decode String but found a number instead.", underlyingError: nil))
  • sku:
Swift.DecodingError.typeMismatch(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "data", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "sku", intValue: nil)], debugDescription: "Expected to decode String but found a number instead.", underlyingError: nil))
  • weight:
Swift.DecodingError.typeMismatch(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "data", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "weight", intValue: nil)], debugDescription: "Expected to decode String but found a number instead.", underlyingError: nil))

Metadata

Metadata

Assignees

Labels

category: reliabilityRelated to app’s reliability, accuracy, and perceived waiting timefeature: variation listRelated to the variations list for variable products.type: taskAn internally driven task.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions