## 概述

`Promise.reject(reason)`方法返回一个带有拒绝原因reason参数的Promise对象。

## 语法

    Promise.reject(reason);

### Parameters

reason
  表示`Promise`被拒绝的原因。

### Return value

  一个给定原因了的被拒绝的 `Promise`。

## 描述

静态函数 `Promise.reject`返回一个被拒绝的`Promise对象`。通过使用`Error`的实例获取错误原因`reason`对调试和选择性错误捕捉很有帮助。

## 示例

### 使用静态`Promise.reject()`方法

    Promise.reject("Testing static reject").then(function(reason) {
      // 未被调用
    }, function(reason) {
      console.log(reason); // "Testing static reject"
    });

    Promise.reject(new Error("fail")).then(function(result) {
      // 未被调用
    }, function(error) {
      console.log(error); // stacktrace
    });

## 规范

规范 | 状态 | 备注
--- | --- | ---
ECMAScript 2015 (6th Edition, ECMA-262) Promise.reject | Standard | ECMA规范的首次定义
ECMAScript Latest Draft (ECMA-262) Promise.reject | Draft |

## 浏览器兼容性

##
We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

- Desktop
- Mobile

Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari
--- | --- | --- | --- | --- | ---
Basic support | 32 | 24.0 (24.0) as `Future` 25.0 (25.0) as `Promise` behind a flag[1] 29.0 (29.0) by default | 未实现 | 19 | 7.1

Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android
--- | --- | --- | --- | --- | --- | ---
Basic support | 未实现 | 24.0 (24.0) as `Future` 25.0 (25.0) as `Promise` behind a flag[1] 29.0 (29.0) by default | 未实现 | 未实现 | iOS 8 | 32

[1] Gecko 24实验性地实施了 `Promise类，它`最初被命名为`Future，`在Gecko 25被重新命名为现在的名字， 但在`dom.promise.enabled设置中被默认禁用。` Bug 918806 Gecko 29开始默认启用Promise。

## 参见

- `Promise`
- 使用BlueBird Promise库进行选择性错误捕捉