Skip to content

Commit

Permalink
fix retrieve call cdr by sid return null
Browse files Browse the repository at this point in the history
  • Loading branch information
xquanluu committed Nov 13, 2024
1 parent 1d873e9 commit d3d4697
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rest/rest-entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class RestEntity {
try {
const res = await this.get(`Accounts/${this.accountSid}/${this.name}/${sid}`);
//get call by sid will return call cdr as a object and not an array
return res ? res : null;
return res;
} catch (err) {
if (err.statusCode === 404) throw new Error(`${this.name}.retrieve: sid ${sid} not found`);
if (err.statusCode !== 204) throw new Error(`${this.name}.retrieve: unexpected status code ${err.statusCode}`);
Expand Down

0 comments on commit d3d4697

Please sign in to comment.