resourceloader: Use state "error" instead of "missing" in case of exceptions

Changes:
* If we catch an exception while making the response for a module, set its
  client state to "error" instead of "missing".
  State "missing" should only be used if the module could not be
  found in the registry.
  This matches the behaviour of the client.

Clean up:
* Merge the two mw.loader.state calls into one.
* Add @throws documentation for compileLESSFile (follows-up cdc8b9e).
* Don't use 3 different ways to assert an array being empty,
  using 1 and sticking to it.
  - !$arr
  - $arr === array()
  - count( $arr )

Change-Id: I54c3de6d836702ffbe3044bc58a38e83e758bc33
Merge "resourceloader: Use state "error" instead of "missing" in case of exceptions"