@jbrowse/plugin-authentication
Version:
JBrowse 2 Authentication
22 lines (21 loc) • 907 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDescriptiveErrorMessage = getDescriptiveErrorMessage;
const util_1 = require("../util");
const dropboxErrorMessages = {
shared_link_not_found: "The shared link wasn't found.",
shared_link_access_denied: 'The caller is not allowed to access this shared link.',
unsupported_link_type: 'This type of link is not supported; use files/export instead.',
shared_link_is_directory: 'Directories cannot be retrieved by this endpoint.',
};
async function getDescriptiveErrorMessage(response, reason) {
let errorMessage = '';
try {
const err = JSON.parse(await response.text());
const tag = err.error['.tag'];
errorMessage = dropboxErrorMessages[tag] || tag;
}
catch (error) {
}
return (0, util_1.getResponseError)({ response, reason, statusText: errorMessage });
}