Skip to content

Commit

Permalink
Include requested url in cantRequestOffline error (#3335)
Browse files Browse the repository at this point in the history
  • Loading branch information
zertosh authored and bestander committed May 12, 2017
1 parent 20e5779 commit 72ccccc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion __tests__/util/request-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ test('RequestManager.request with offlineNoRequests', async () => {
try {
await config.requestManager.request({url: `https://localhost:port/?nocache`, headers: {Connection: 'close'}});
} catch (err) {
expect(err.message).toBe('Can\'t make a request in offline mode');
expect(err.message).toBe('Can\'t make a request in offline mode ("https://localhost:port/?nocache")');
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/reporters/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ const messages = {
infoFail: 'Received invalid response from npm.',
malformedRegistryResponse: 'Received malformed response from registry for $0. The registry may be down.',

cantRequestOffline: 'Can\'t make a request in offline mode',
cantRequestOffline: 'Can\'t make a request in offline mode ($0)',
requestManagerNotSetupHAR: 'RequestManager was not setup to capture HAR files',
requestError: 'Request $0 returned a $1',
requestFailed: 'Request failed $0',
Expand Down
4 changes: 3 additions & 1 deletion src/util/request-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ export default class RequestManager {

request<T>(params: RequestParams<T>): Promise<T> {
if (this.offlineNoRequests) {
return Promise.reject(new MessageError(this.reporter.lang('cantRequestOffline')));
return Promise.reject(
new MessageError(this.reporter.lang('cantRequestOffline', params.url)),
);
}

const cached = this.cache[params.url];
Expand Down

0 comments on commit 72ccccc

Please sign in to comment.