@azure/cognitiveservices-translatortext1.0.0Windows 10 2004 OS Build 19041.207Edge Chromium Dev: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.3 Safari/537.36 Edg/83.0.478.53.8.3Describe the bug
In the case below, the RestError thrown isn't conveniently typed. The code property is undefined, and the message property is JSON with a code and message.
To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/nguerrera/translatorcd translatorgit checkout repro-error-issue npm installnpm start12345678901234567890123456789012 as API key to trigger auth error (It has to be 32 chars as the code doesn't bother trying to connect otherwise)Expected behavior
error.message is The request is not authorized because credentials are missing or invalid.
error.code is 401000
Actual behavior
error.code is undefined
error.message is {"error":{"code":401000,"message":"The request is not authorized because credentials are missing or invalid."}}
Screenshots

Additional context
N/A
(You can remove the "customer-reported" tag. I work at Microsoft, just joined the team, and found this while experimenting as a ramping up exercise.)
@sarangan12, This seems to be similar to the issue we had with storage when parsing the error response. Can you take a look?
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @dfulcer.
@ramya-rao-a Yes. I have confirmed. This is same as the storage issue https://github.com/Azure/azure-sdk-for-js/issues/4999. The Code changes have been completed in core-http package in PR https://github.com/Azure/azure-sdk-for-js/pull/5437.
This issue deals with translator text which depends on the ms-rest-js. So, the issue is still happening. Do you want the same fix to be ported to ms-rest-js? Please let me know.
Yes, lets port the fix over to ms-rest-js