Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

error checking weather data response #468

Merged

Conversation

davidmsibley
Copy link
Contributor

The weather widget will not put itself in an error state unless a network error occurs. This checks the data response for reported errors, and treats that as an error condition.


Contributor License Agreement adherence:

Copy link
Contributor

@vertein vertein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If statements in JS are great

Copy link
Contributor

@ChristianMurphy ChristianMurphy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I guess 😅

if (data) {
if (
data && 2 === data.length && data[0] && data[1] &&
(!data[0].errors || (data[0].errors && 0 >= data[0].errors.length))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an area where JSON Schema could come in handy.

{
  "type": "array",
  "minItems": 2,
  "maxItems": 2,
  "items": {
    "type": "object",
    "properties": {
      "errors": {
        "type": "array",
        "maxItems": 0
      }
    }
}

@davidmsibley davidmsibley merged commit 6ae7135 into uPortal-Attic:master Jul 6, 2017
@davidmsibley davidmsibley deleted the whether-weather-errors branch July 6, 2017 20:11
@davidmsibley davidmsibley modified the milestone: 5.0.0 Aug 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants