Fix 251: Improve error handling

Fix #251

TODO:
- [ ] Update README;
- [ ] Get rid of the human readable messages on minifieds;
- [ ] Fix cldrjs entry on bower.json;

### What has been done?

This PR standardize error handling throughout Globalize. All errors thrown (by Globalize) are an instance of Error. They define a message and a code attribute. It may also define more attributes as shown below.

Four different kind of errors are handled:

- `E_DEFAULT_LOCALE_NOT_DEFINED`

Thrown when any static method, eg. `Globalize.formatNumber()` is used prior to setting the Global locale with `Globalize.locale( <locale> )`. Error object attributes: code.

- `E_MISSING_PARAMETER`

Thrown when a required parameter is missing on any static or instance methods. Error object attributes: code and name (containing the name of the missing parameter).

- `E_INVALID_PAR_TYPE`

Thrown when a parameter has an invalid type on any static or instance methods. Error object attributes: code, expected (expected type, eg. Number), name (parameter name), value (parameter passed value).

- `E_INVALID_PAR_VALUE`

Thrown for certain parameters when the type is correct, but the value is invalid. Currently, the only parameter with such validation is the date format (for either format and parse). Format allows [certain variants](https://github.com/jquery/globalize/blob/master/doc/api/date/format.md#parameters), if it's none of them, error is thrown. Error object attributes: code, value (parameter passed value).

- `E_MISSING_CLDR`

Thrown when any required CLDR item is not found. Error object attributes: code, path (CLDR item path not found).

### How does it fix 251?
 
**1) Throw error when default locale isn't set  (on all modules)**

Example:

```
> Globalize.formatNumber(4)
Error: E_DEFAULT_LOCALE_NOT_DEFINED: Default locale has not been defined.
    at createError (/tmp/node_modules/globalize/dist/globalize.js:114:10)
    at validate (/tmp/node_modules/globalize/dist/globalize.js:142:9)
    at validateDefaultLocale (/tmp/node_modules/globalize/dist/globalize.js:150:2)
    at Function.Globalize.formatNumber.Globalize.formatNumber (/tmp/node_modules/globalize/dist/globalize/number.js:839:2)
    at repl:1:12
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
    at Interface._line (readline.js:531:8)
```

Error object:

```
{
  "code": "E_DEFAULT_LOCALE_NOT_DEFINED"
}
```


**2) Throw error on missing parameter (on all modules)**

All parameters of all public API methods are validated for presence. Example:
```
> Globalize.formatNumber()
value: E_MISSING_PARAMETER: Missing required parameter `value`.
    at createError (/tmp/node_modules/globalize/dist/globalize.js:114:10)
    at validate (/tmp/node_modules/globalize/dist/globalize.js:142:9)
    at validatePresence (/tmp/node_modules/globalize/dist/globalize.js:150:2)
    at Function.Globalize.formatNumber.Globalize.formatNumber (/tmp/node_modules/globalize/dist/globalize/number.js:831:2)
    at repl:1:12
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
    at Interface._line (readline.js:531:8)
```

Error object:

```
{
  "code": "E_MISSING_PARAMETER",
  "name": "value"
}
```

**3) Throw error on invalid parameter type (on all modules)**

All parameters of all public API methods are validated for correct type. Example:
```
> Globalize("en").formatNumber("4")
value: E_INVALID_PAR_TYPE: invalid `value` parameter (4). Number expected.
    at createError (/tmp/node_modules/globalize/dist/globalize.js:114:10)
    at validate (/tmp/node_modules/globalize/dist/globalize.js:142:9)
    at validateType (/tmp/node_modules/globalize/dist/globalize.js:159:2)
    at validateTypeNumber (/tmp/node_modules/globalize/dist/globalize/number.js:41:2)
    at Globalize.formatNumber.Globalize.formatNumber (/tmp/node_modules/globalize/dist/globalize/number.js:832:2)
    at repl:1:18
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
```

Error object:

```
{
  "code": "E_INVALID_PAR_TYPE",
  "expected": "Number",
  "name": "value",
  "value": "4"
}
```

**4) Throw error on the lack of likelySubtags (on locale initialization)**

```
> Globalize("en")
Error: E_MISSING_CLDR: Missing required CLDR content `supplemental/likelySubtags`.
    at createError (/tmp/node_modules/globalize/dist/globalize.js:114:10)
    at validateCldr (/tmp/node_modules/globalize/dist/globalize.js:130:10)
    at validateLikelySubtags (/tmp/node_modules/globalize/dist/globalize.js:204:9)
    at new Globalize (/tmp/node_modules/globalize/dist/globalize.js:227:2)
    at Globalize (/tmp/node_modules/globalize/dist/globalize.js:219:10)
    at repl:1:2
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
```

Or

```
> Globalize.locale("en")
Error: E_MISSING_CLDR: Missing required CLDR content `supplemental/likelySubtags`.
    at createError (/tmp/node_modules/globalize/dist/globalize.js:114:10)
    at validateCldr (/tmp/node_modules/globalize/dist/globalize.js:130:10)
    at validateLikelySubtags (/tmp/node_modules/globalize/dist/globalize.js:204:9)
    at Function.Globalize.locale (/tmp/node_modules/globalize/dist/globalize.js:261:3)
    at repl:1:12
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
    at Interface._line (readline.js:531:8)
```

Error object in both cases:

```
{
  "code": "E_MISSING_CLDR",
  "path": "supplemental/likelySubtags"
}
```

**5) Throw error on the lack of any needed date fields - main or supplemental data (on data module)**

An example validating a main path:
```
> Globalize("en").formatDate(new Date(), "d")
Error: E_MISSING_CLDR: Missing required CLDR content `main/en/dates/calendars/gregorian/dateTimeFormats/availableFormats/d`.
    at createError (/tmp/node_modules/globalize/dist/globalize.js:114:10)
    at validateCldr (/tmp/node_modules/globalize/dist/globalize.js:130:10)
    at Globalize.formatDate.Globalize.formatDate (/tmp/node_modules/globalize/dist/globalize/date.js:1208:9)
    at repl:1:18
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
    at Interface._line (readline.js:531:8)
    at Interface._ttyWrite (readline.js:760:14)
```

Error object:

```
{
  "code": "E_MISSING_CLDR",
  "path": "main/en/dates/calendars/gregorian/dateTimeFormats/availableFormats/d"
}
```

An example validating a supplemental path:

```
> Globalize("en").formatDate(new Date(), {pattern:"e"})
Error: E_MISSING_CLDR: Missing required CLDR content `supplemental/weekData/firstDay/001`.
    at createError (/tmp/node_modules/globalize/dist/globalize.js:114:10)
    at validateCldr (/tmp/node_modules/globalize/dist/globalize.js:130:10)
    at Globalize.formatDate.Globalize.formatDate (/tmp/node_modules/globalize/dist/globalize/date.js:1208:9)
    at repl:1:18
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
    at Interface._line (readline.js:531:8)
    at Interface._ttyWrite (readline.js:760:14)
```

Error object:

```
{
  "code": "E_MISSING_CLDR",
  "path": "supplemental/weekData/firstDay/001"
}
```

**6) Throw error on the lack of any needed number fields (on number module)**

```
> Globalize("en").formatNumber(5)
Error: E_MISSING_CLDR: Missing required CLDR content `main/en/numbers/defaultNumberingSystem`.
    at createError (/tmp/node_modules/globalize/dist/globalize.js:114:10)
    at validateCldr (/tmp/node_modules/globalize/dist/globalize.js:130:10)
    at Globalize.formatNumber.Globalize.formatNumber (/tmp/node_modules/globalize/dist/globalize/number.js:845:9)
    at repl:1:18
    at REPLServer.self.eval (repl.js:110:21)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
    at Interface._line (readline.js:531:8)
    at Interface._ttyWrite (readline.js:760:14)
```

Error object:

```
{
  "code": "E_MISSING_CLDR",
  "path": "main/en/numbers/defaultNumberingSystem"
}
```

Ideally, all assistant-errors could be easily removed on minification to save bytes.

OBS: On every validation, include the respective value to the error message (make debugging it slightly easier).
Before reading this comment. Make sure you read https://github.com/jquery/globalize/pull/268/files#discussion_r13979499.

> The simpler (and more correct) approach in my opinion has been to delegate such validation check to cldrjs. So, I simply use the code in Globalize with no prior check and let cldrjs throw when it doesn't find a required CLDR part.

Both above functions (common/cldr/get.js and common/cldr/main.js) are related to the "required CLDR part" I mentioned in the quoted paragraph above.

Cldr.js `get` should NOT throw for all missing data. Because, fallback is a common thing in CLDR, eg. return data `a` or `b`. Therefore, the optional parameter `throw: true` was the approach I came up with in order to force cldr.js to throw on missing data.

Instead of repeating `{ throw: true }` on every Cldr get calls through the entire Globalize code, I preferred wrapping it into the above two functions.

I am not sure the chosen name cldrGet (and cldrMain) is clear. I'm in having an internal conflict :grin: with something like cldrRequiredGet (and cldrRequiredMain) instead. Sometimes I think the more descriptive is better, sometimes the shorter...