in src/controller/lintController.ts [140:183]
private async fetchLints(guid: string, version: string) {
const { id: addonID, fileIDs: fileIDs } =
await this.addonCacheController.getAddonFromCache([guid]);
const fileID = fileIDs[version];
if (!fileID || !addonID) {
return;
}
const url = `${constants.apiBaseURL}reviewers/addon/${addonID}/file/${fileID}/validation/`;
const headers = await this.credentialController.makeAuthHeader();
const response = await fetch(url, { headers });
if (!response.ok) {
const errorMessages: ErrorMessages = {
window: {
404: `(Status ${response.status}): Failed to lint. Validation not found.`,
401: `(Status ${response.status}): Failed to lint. Unauthorized request.`,
403: `(Status ${response.status}): Failed to lint. Inadequate permissions`,
other: `(Status ${response.status}): Could not fetch lint.`,
},
thrown: {
404: "Failed to lint. Validation not found.",
401: "Failed to lint. Unauthorized request.",
403: "Failed to lint. Inadequate permissions",
other: "Could not fetch lint.",
},
};
await NotificationView.showErrorMessage(
errorMessages,
response.status,
this.fetchLints,
[guid]
);
return;
}
const json = await response.json();
return json.validation;
}