tumblr / collins

groovy kind of love
tumblr.github.com/collins
Apache License 2.0
571 stars 99 forks source link

Multicollins doesn't work if asset types do not match #499

Open william-richard opened 7 years ago

william-richard commented 7 years ago

If the remote collins server has a different set of asset types than local collins, multicollins queries will fail. I think collins is trying to serialize the asset type for the remote assets, but since local collins doesn't know about the type, it fails.

Not sure how to fix this. Here are a few ideas: 1) handle the error more gracefully, and have some sort of UNKNOWN value that it populates in situations where it doesn't know how to handle the type 2) Get the list of types from the remote server and use them to create a temporary list of asset types that include the local and remote types. Use that to correctly format and serialize the response. 3) Something else.

I do not know if this is caused by collins having an unknown asset type name, or if it's an out of bounds error. If it's an out of bounds situation, we have a bigger problem, where you could have 2 collins servers that have the same number of asset types but the types have different names and labels, so a multicollins query would return incorrect information. Whomever tackles fixing this should probably try to better understand the nature of the bug before they try to fix it.

java.util.NoSuchElementException: None.get
    at scala.None$.get(Option.scala:347) ~[scala-library-2.11.7.jar:na]
    at scala.None$.get(Option.scala:345) ~[scala-library-2.11.7.jar:na]
    at collins.models.conversions$AssetFormat$.reads(conversions.scala:135) ~[classes/:na]
    at collins.models.conversions$AssetFormat$.reads(conversions.scala:131) ~[classes/:na]
    at play.api.libs.json.Json$.fromJson(Json.scala:115) ~[play-json_2.11-2.3.9.jar:2.3.9]