chrome-addon
chrome-addon copied to clipboard
Improve default error logging
Rather than using axios error.message, the code should report the API error response. For example, I was getting a 400 error, which turned out to be because the previous version was still pending verification.
I think something like
error.response.data.itemError.forEach(e => core.setFailed(e.error_detail));
in run()'s catch condition should do the work. Maybe add conditional chaining to avoid no response errors, but I don't know if that works in typescript.
P.S.: I had been testing the code on a fork, and I can't make it work. Idk why, the response message should be in error.response.data, but its content is different to the original response.data debuged.
In my case, I'm expecting to see the following response:
{
"kind":"chromewebstore#item",
"id":"...",
"uploadState":"FAILURE",
"itemError":[{
"error_code":"ITEM_NOT_UPDATABLE",
"error_detail":"The item cannot be updated now because it is in pending review, ready to publish, or deleted status."
}]
}