diff --git a/lib/client.js b/lib/client.js index c2b28214..49952964 100644 --- a/lib/client.js +++ b/lib/client.js @@ -7,9 +7,6 @@ const merge = require('merge-descriptors'); const platform = require('platform'); const utility = require('utility'); const urllib = require('urllib'); -const { - Base64: { decode: base64ToStr } -} = require('js-base64'); const pkg = require('../package.json'); const bowser = require('bowser'); const signUtils = require('./common/signUtils'); @@ -381,6 +378,7 @@ proto.requestError = async function requestError(result) { err.status = result.status; err.code = info.Code; err.requestId = info.RequestId; + err.ecCode = info.EC; err.hostId = info.HostId; }; @@ -412,7 +410,7 @@ proto.requestError = async function requestError(result) { err.status = result.status; const ossErr = result.headers['x-oss-err']; if (ossErr) { - const message = base64ToStr(ossErr); + const message = Buffer.from(ossErr, 'base64').toString('utf8'); await setError(message); } err.res = result;