mozilla/fxa-content-server — pull request #1630 by shane-tomlinson (2014-09-08 16:58:35+00:00)
Title: chore(metrics): Namespace errors for metrics logging and other error logging updates.

@kparlante asked for us to add a bit of context, like a screen name, to errors so that it is easier to decide where an error originated. This led down a bit of a rabbit hole of cleaning up the error code.

* The different error types overlap in their errno's, this adds a namespace so that different errors are able to be selected from the metrics logs.

Namespaces used:
* auth-errors.js: 'auth'
* oauth-errors.js: 'oauth'
* profile-client.js: 'profile'

* The `message` field of auth-errors.js.toError was never used, so this is repuprosed to pass in a `context`.
* The format of an error event has changed to accommodate a context: 'error...
* When a view's `logError` function is called, the screen name is set as the error's context.
* base.js called metrics.js to fetch ids for screens and errors, then called metrics.js->logEvent. Updated to just call `logError` and `logScreen`
* A couple of TestHelper functions were added: `isScreenLogged` and `isErrorLogged`

fixes #1500