Unable to catch error using SDK API

api
.post(“users.create”, {
name: data.name,
email: data.email,
password: data.password,
username: data.username,
roles: [“anonymous”]
}).then(res => {console.log(res)})
.catch(err => console.error(err))

But I am unable to log errors like the one generated by API
[API] POST error (users.create): {
success: false,
error: ‘lksl is already in use :frowning: [error-field-unavailable]’,
errorType: ‘error-field-unavailable’
}