Skip to content

Commit 58d6dc4

Browse files
committed
fix(clientConstructor): throw request error instead of suppressing them
1 parent e92f378 commit 58d6dc4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/create-client.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ export const clientConstructor = ({ token, ...options }) => {
3535
}
3636
})
3737
.then(response => response.data)
38-
.catch(error => error.response.data)
38+
.catch(error => {
39+
if (error && error.response && error.response.data && error.response.data.description) {
40+
throw new Error(error.response.data.description)
41+
} else {
42+
throw new Error('Couldn\'t make request')
43+
}
44+
})
3945
}
4046
}
4147
}

0 commit comments

Comments
 (0)