Prefix domain (un)register calls with the domain which failed

The info would also be in the extra error info, however we catch the
error in apptask and here we don't know if this is a domain error or
something else.
This commit is contained in:
Johannes Zellner
2025-12-09 14:36:36 +01:00
parent 748f3a3a4f
commit f421fd771f
+3 -3
View File
@@ -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) {