mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #730 from sharelatex/sk-handle-orphaned-mendeley-linked-files
Add a new error type to LinkedFiles: FileCannotRefreshError
This commit is contained in:
commit
f5ea7f2d77
2 changed files with 16 additions and 2 deletions
|
@ -17,7 +17,8 @@ LinkedFilesHandler = require './LinkedFilesHandler'
|
||||||
SourceFileNotFoundError,
|
SourceFileNotFoundError,
|
||||||
NotOriginalImporterError,
|
NotOriginalImporterError,
|
||||||
FeatureNotAvailableError,
|
FeatureNotAvailableError,
|
||||||
RemoteServiceError
|
RemoteServiceError,
|
||||||
|
FileCannotRefreshError
|
||||||
} = require './LinkedFilesErrors'
|
} = require './LinkedFilesErrors'
|
||||||
Modules = require '../../infrastructure/Modules'
|
Modules = require '../../infrastructure/Modules'
|
||||||
|
|
||||||
|
@ -138,6 +139,10 @@ module.exports = LinkedFilesController = {
|
||||||
"The remote service produced an error"
|
"The remote service produced an error"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
else if error instanceof FileCannotRefreshError
|
||||||
|
res.status(400).send(
|
||||||
|
"This file cannot be refreshed"
|
||||||
|
)
|
||||||
|
|
||||||
else
|
else
|
||||||
next(error)
|
next(error)
|
||||||
|
|
|
@ -94,6 +94,14 @@ RemoteServiceError = (message) ->
|
||||||
RemoteServiceError.prototype.__proto__ = Error.prototype
|
RemoteServiceError.prototype.__proto__ = Error.prototype
|
||||||
|
|
||||||
|
|
||||||
|
FileCannotRefreshError = (message) ->
|
||||||
|
error = new Error(message)
|
||||||
|
error.name = 'RemoteService'
|
||||||
|
error.__proto__ = FileCannotRefreshError.prototype
|
||||||
|
return error
|
||||||
|
FileCannotRefreshError.prototype.__proto__ = Error.prototype
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
UrlFetchFailedError,
|
UrlFetchFailedError,
|
||||||
|
@ -107,5 +115,6 @@ module.exports = {
|
||||||
SourceFileNotFoundError,
|
SourceFileNotFoundError,
|
||||||
NotOriginalImporterError,
|
NotOriginalImporterError,
|
||||||
FeatureNotAvailableError,
|
FeatureNotAvailableError,
|
||||||
RemoteServiceError
|
RemoteServiceError,
|
||||||
|
FileCannotRefreshError
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue