             })
 
         dispatch_async(dispatch_get_main_queue()) {
-            promise.reject(NSError(domain: "", code: -1, userInfo: nil))
+            promise.reject(self.generateRandomError())
         }
 
         self.waitForExpectationsWithTimeout(1.0, handler: nil)


    func testPropagateNSErrorInCallbackReturnsPromise() {
        let expectation = self.expectationWithDescription("wait")
        let promise = Promise<Int>()

        promise
            .then({ (i) throws -> Promise<Int> in
                throw NSError(domain: "test.SomeError", code: 123, userInfo: nil)
            })
            .then(nil, { (e: NSError) in
                XCTAssertEqual(e.domain, "test.SomeError")
                XCTAssertEqual(e.code, 123)
                expectation.fulfill()
            })



        let promise = Promise<Int>()

        promise.reject(self.generateRandomError())

        promise
            .then({ (value) -> Promise<Int> in
