Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix($httpBackend): ugly solution for unexpected request fail on verif…
Browse files Browse the repository at this point in the history
…y no outstanding request
  • Loading branch information
marcin-wosinek committed Aug 6, 2017
1 parent c1ad9ac commit 8502070
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/ng/q.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,10 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
}
} catch (e) {
rejectPromise(promise, e);
// TODO ugly!
if (e.rethrow === true) {
exceptionHandler(e);
}
}
}
} finally {
Expand Down
7 changes: 6 additions & 1 deletion src/ngMock/angular-mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -1438,10 +1438,15 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
return;
}
}
throw wasExpected ?
var error = wasExpected ?
new Error('No response defined !') :
new Error('Unexpected request: ' + method + ' ' + url + '\n' +
(expectation ? 'Expected ' + expectation : 'No more request expected'));

// TODO ugly!
error.rethrow = true;

throw error;
}

/**
Expand Down

0 comments on commit 8502070

Please sign in to comment.