Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Commit 2418614

Browse files
authored
Merge pull request #18 from mobify/update-fault-model
Update Fault Model
2 parents bf46b39 + 82c4b07 commit 2418614

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## To be released
2+
- Update `Fault` model to have `arguments` property. [#18](https://github.com/mobify/commercecloud-ocapi-client/pull/18)
3+
14
## v0.1.7 (February 5, 2019)
25
- Add relevant properties to `VariationAttributeValue` model and some others. [#15](https://github.com/mobify/commercecloud-ocapi-client/pull/15)
36

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/models/Fault.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ export default class Fault {
4141
* @member {String} type
4242
*/
4343
this.type = undefined
44+
45+
/**
46+
* These are optional arguments returned with fault
47+
* @member {Object} arguments
48+
*/
49+
this.arguments = undefined
4450
}
4551

4652
/**
@@ -62,6 +68,9 @@ export default class Fault {
6268
if (data.hasOwnProperty('type')) {
6369
obj['type'] = ApiClient.convertToType(data['type'], 'String')
6470
}
71+
if (data.hasOwnProperty('arguments')) {
72+
obj['arguments'] = ApiClient.convertToType(data['arguments'], {String: Object})
73+
}
6574
}
6675

6776
return obj

test/api/StoresApi.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ describe('StoresApi', () => {
7575
expect(store.constructor.name).to.be('Store')
7676
})
7777
)
78+
79+
it('should throw Fault when calling getStoresByID with unknown store id', () => {
80+
instance.getStoresByID('badstoreid')
81+
.catch((fault) => {
82+
expect(fault.constructor.name).to.be('Fault')
83+
console.log('fault: ', fault)
84+
})
85+
})
7886
})
7987

8088
describe('getStoresByIDs', () => {

0 commit comments

Comments
 (0)