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

Commit

Permalink
feat: improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
gigobyte committed May 12, 2020
1 parent b87e248 commit f279d8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export class HttpClient {

const ErrorToThrow = errorMap[errorCode]

throw enhanceError(new ErrorToThrow(`Request failed with ${errorCode}`), response)
throw enhanceError(new ErrorToThrow(`${info.action} request failed`), response)
}

throw error
Expand Down
4 changes: 2 additions & 2 deletions test/unit/http.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { amazonMarketplaces, HttpClient, HttpError } from '../../src'
import { amazonMarketplaces, HttpClient, InvalidParameterValue } from '../../src'
import { Resource } from '../../src/http'
import { getFixture } from '../utils'

Expand Down Expand Up @@ -26,6 +26,6 @@ describe('httpClient', () => {
action: 'GetServiceStatus',
parameters: {},
}),
).rejects.toStrictEqual(new HttpError('Request failed with InvalidParameterValue'))
).rejects.toStrictEqual(new InvalidParameterValue('GetServiceStatus request failed'))
})
})

0 comments on commit f279d8e

Please sign in to comment.