mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Logging and error message tweaks
This commit is contained in:
parent
d4025908b7
commit
d92c3e8b55
2 changed files with 4 additions and 3 deletions
|
@ -24,6 +24,7 @@ module.exports = LinkedFilesController = {
|
|||
linkedFileData.provider = provider
|
||||
Agent.writeIncomingFileToDisk project_id, linkedFileData, user_id, (error, fsPath) ->
|
||||
if error?
|
||||
logger.error {err: error, project_id, name, linkedFileData, parent_folder_id, user_id}, 'error writing linked file to disk'
|
||||
return Agent.handleError(error, req, res, next)
|
||||
EditorController.upsertFile project_id, parent_folder_id, name, fsPath, linkedFileData, "upload", user_id, (error) ->
|
||||
return next(error) if error?
|
||||
|
|
|
@ -31,15 +31,15 @@ module.exports = UrlAgent = {
|
|||
callback = _.once(callback)
|
||||
url = data.url
|
||||
if !urlValidator.isWebUri(url)
|
||||
return callback(new InvalidUrlError())
|
||||
url = @._wrapWithProxy(url)
|
||||
return callback(new InvalidUrlError("invalid url: #{url}"))
|
||||
url = UrlAgent._wrapWithProxy(url)
|
||||
readStream = request.get(url)
|
||||
readStream.on "error", callback
|
||||
readStream.on "response", (response) ->
|
||||
if 200 <= response.statusCode < 300
|
||||
FileWriter.writeStreamToDisk project_id, readStream, callback
|
||||
else
|
||||
error = new UrlFetchFailedError()
|
||||
error = new UrlFetchFailedError("url fetch failed: #{url}")
|
||||
error.statusCode = response.statusCode
|
||||
callback(error)
|
||||
|
||||
|
|
Loading…
Reference in a new issue