@jbrowse/plugin-authentication
Version:
JBrowse 2 Authentication
19 lines (18 loc) • 769 B
JavaScript
import { getResponseError } from '../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.',
};
export 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 getResponseError({ response, reason, statusText: errorMessage });
}