Merge pull request #4341 from overleaf/jpa-ta-error-message-linked-files

[misc] better error msg for failed compiles when linking project files

GitOrigin-RevId: cac3d9e5cf25918dc8f5e259d106c145235c15c1
This commit is contained in:
Alexandre Bourdin 2021-07-30 10:57:48 +02:00 committed by Copybot
parent 3d963027eb
commit 4b4ed6147c
8 changed files with 20 additions and 3 deletions

View file

@ -21,6 +21,7 @@ const logger = require('logger-sharelatex')
const _ = require('underscore')
const LinkedFilesHandler = require('./LinkedFilesHandler')
const {
CompileFailedError,
UrlFetchFailedError,
InvalidUrlError,
OutputFileFetchFailedError,
@ -152,6 +153,10 @@ module.exports = LinkedFilesController = {
.send(
'Sorry, the source project is not yet imported to Overleaf v2. Please import it to Overleaf v2 to refresh this file'
)
} else if (error instanceof CompileFailedError) {
return res
.status(422)
.send(res.locals.translate('generic_linked_file_compile_error'))
} else if (error instanceof OutputFileFetchFailedError) {
return res.status(404).send('Could not get output file')
} else if (error instanceof UrlFetchFailedError) {

View file

@ -4,6 +4,7 @@ class UrlFetchFailedError extends BackwardCompatibleError {}
class InvalidUrlError extends BackwardCompatibleError {}
class CompileFailedError extends BackwardCompatibleError {}
class OutputFileFetchFailedError extends BackwardCompatibleError {}
class AccessDeniedError extends BackwardCompatibleError {}
@ -27,6 +28,7 @@ class RemoteServiceError extends BackwardCompatibleError {}
class FileCannotRefreshError extends BackwardCompatibleError {}
module.exports = {
CompileFailedError,
UrlFetchFailedError,
InvalidUrlError,
OutputFileFetchFailedError,

View file

@ -21,6 +21,7 @@ const ClsiManager = require('../Compile/ClsiManager')
const ProjectFileAgent = require('./ProjectFileAgent')
const _ = require('underscore')
const {
CompileFailedError,
BadDataError,
AccessDeniedError,
BadEntityTypeError,
@ -268,7 +269,7 @@ module.exports = ProjectOutputFileAgent = {
return callback(err)
}
if (status !== 'success') {
return callback(new OutputFileFetchFailedError())
return callback(new CompileFailedError())
}
const outputFile = _.find(
outputFiles,

View file

@ -97,6 +97,7 @@
"from_provider": "",
"full_doc_history": "",
"full_screen": "",
"generic_linked_file_compile_error": "",
"generic_something_went_wrong": "",
"get_collaborative_benefits": "",
"git_bridge_modal_description": "",

View file

@ -52,6 +52,13 @@ export default function ErrorMessage({ error }) {
</DangerMessage>
)
case 'linked-project-compile-error':
return (
<DangerMessage>
{t('generic_linked_file_compile_error')}
</DangerMessage>
)
default:
// TODO: convert error.response.data to an error key and try again?
// return error

View file

@ -34,7 +34,7 @@ export function useProjectOutputFiles(projectId) {
setData(filteredFiles.sort(alphabetical))
} else {
setError(true)
setError('linked-project-compile-error')
}
})
.catch(error => setError(error))

View file

@ -76,7 +76,7 @@ export default function FileViewHeader({ file, storeReferencesKeys }) {
})
.catch(err => {
setRefreshing(false)
setRefreshError(err.message)
setRefreshError(err.data?.message || err.message)
})
.finally(() => {
if (

View file

@ -1,4 +1,5 @@
{
"generic_linked_file_compile_error": "This project's output files are not available because it failed to compile. Please open the project to see the compilation error details.",
"chat_error": "Could not load chat messages, please try again.",
"reconnect": "Try again",
"no_pdf_error_title": "No PDF",