这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@zberkom
Copy link

@zberkom zberkom commented Feb 5, 2018

I ran into this issue recently on CC. Basically, we had a library that returns :unknown atom keys instead of nil when it can't find a value. For example:

%UAInspector.Result{
  client: %UAInspector.Result.Client{
    engine: "Blink",
    engine_version: :unknown,
    name: "Chrome",
    type: "browser",
    version: "63.0.3239.132"
  },
  device: %UAInspector.Result.Device{
    brand: :unknown,
    model: :unknown,
    type: "desktop"
  },
  os: %UAInspector.Result.OS{
    name: "Mac",
    platform: :unknown,
    version: "10.12.6"
  },
  user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
}

Running maybe(ua.device.model.name) would fail with BadMapError with message "expected a map, got: :unknown"

This PR resolves this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants