Hi I’m new to this so please be patient
I’ve been checking the cloud error messages in different situations and they are not very consistent for example:
// ----------- Device turned off -----------------
{
"error": "Timed out."
}
// ------------ incorrect variable --------------
{
"ok": false,
"error": "Variable not found"
}
// -------------------- incorrect device ID --------------
{
"error": "Permission Denied",
"info": "I didn't recognize that device name or ID, try opening https://api.particle.io/v1/devices?access_token=MY_ACCESS_TOKEN"
}
// -------------------- incorrect access Token --------------
{
"error": "invalid_token",
"error_description": "The access token provided is invalid."
}
Device not found
and incorrect variable
both return the error key, so I could look for this to check for errors, but incorrect device ID
and incorrect access token
both return extended error information, but incorrect device ID
returns extended info in the key "info"
and incorrect access token
returns it in the key "error_description"
.
I can code for this, but it makes it a messy program.
It would be nice if extended error information was always available when an error occurs in the return JSON string and used the same key name to point to it.
Thanks for reading…
Steve