diff --git a/src/dns.js b/src/dns.js index dff824e34..a0dc101c2 100644 --- a/src/dns.js +++ b/src/dns.js @@ -236,7 +236,7 @@ async function registerLocation(location, options, recordType, recordValue) { if (getError) { const retryable = getError.reason !== BoxError.ACCESS_DENIED && getError.reason !== BoxError.NOT_FOUND; // NOT_FOUND is when zone is not found debug(`registerLocation: Get error. retryable: ${retryable}. ${getError.message}`); - throw new BoxError(getError.reason, getError.message, { domain: location, retryable }); + throw new BoxError(getError.reason, `${location.domain}: ${getError.message}`, { domain: location, retryable }); } if (values.length === 1 && values[0] === recordValue) return; // up-to-date @@ -248,7 +248,7 @@ async function registerLocation(location, options, recordType, recordValue) { if (upsertError) { const retryable = upsertError.reason === BoxError.BUSY || upsertError.reason === BoxError.EXTERNAL_ERROR; debug(`registerLocation: Upsert error. retryable: ${retryable}. ${upsertError.message}`); - throw new BoxError(BoxError.EXTERNAL_ERROR, upsertError.message, { domain: location, retryable }); + throw new BoxError(BoxError.EXTERNAL_ERROR, `${location.domain}: ${getError.message}`, { domain: location, retryable }); } } @@ -302,7 +302,7 @@ async function unregisterLocation(location, recordType, recordValue) { const retryable = error.reason === BoxError.BUSY || error.reason === BoxError.EXTERNAL_ERROR; debug(`unregisterLocation: Error unregistering location ${recordType}. retryable: ${retryable}. ${error.message}`); - throw new BoxError(BoxError.EXTERNAL_ERROR, error, { domain: location, retryable }); + throw new BoxError(BoxError.EXTERNAL_ERROR, `${location.domain}: ${error.message}`, { domain: location, retryable }); } async function unregisterLocations(locations, progressCallback) {