Fix 251: Improve error handling

Fix #251

TODO:
- https://github.com/jquery/globalize/pull/268#discussion_r14087217
- [x] Update README;
- (postpone) Get rid of the human readable messages on minifieds;
- [x] Custom error assertion checking error object attributes see `https://github.com/jquery/globalize/pull/268/#issuecomment-46658013`;
- [ ] Fix cldrjs entry on bower.json;
- [ ] Use cldr.js missing cldr item error instead of mapping it to a Globalize one;

### 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 kinds 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).
To validate supplemental timeData or weekData here is wrong. Because, this content is not alwayes required. It depends on the use case. It may complain to load a data that is never used.

One alternative could be placing those validations where they are really needed. Although, this is a little cumbersome, since it's used in several places and it depends on the user input (eg. certain format/parse patterns may use it, some may not).