emberjs/data — pull request #1547 by lukemelia (2013-12-05 03:44:08+00:00)
Title: Throw instead of assert in `modelFor` when type can't be resolved.

Background: Asserts are stripped out of production builds. In production,
it is possible that a root key in an API response changes in a way that
your serializer's `typeForRoot` implementation does not convert properly.
Since the assert in `modelFor` is stripped in production builds, the
javascript error raised in a production environment would be:

"Cannot set property 'typeKey' on undefined"

This commit changes the assert to a check and throw so the error
raised would be something like:

"No model was found for 'home_planet'"

The provides a much more helpful error for real-world production
errors at a relatively small price (one extra line of code and
a simple value check).