Skip to content

Commit eb4e173

Browse files
committed
add error_code for luno API errors
1 parent 5d4243b commit eb4e173

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/BitX.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ BitX.prototype._request = function (method, resourcePath, data, callback) {
7070
if (res.statusCode !== 200) {
7171
try {
7272
response = JSON.parse(response)
73-
return callback(new Error('luno API error ' + response.error_code + ': ' + response.error))
73+
var err = new Error('luno API error ' + response.error_code + ': ' + response.error)
74+
err.error_code = response.error_code
75+
return callback(err)
7476
} catch (err) {
7577
return callback(new Error('luno unknown API error ' + res.statusCode + ': ' + response))
7678
}

0 commit comments

Comments
 (0)