Reconfigure internal CLSI call to understand more than just success/failure
This commit is contained in:
@@ -17,7 +17,7 @@ module.exports = ClsiManager =
|
||||
logger.log project_id: project_id, response: response, "received compile response from CLSI"
|
||||
callback(
|
||||
null
|
||||
(response?.compile?.status == "success")
|
||||
response?.compile?.status
|
||||
ClsiManager._parseOutputFiles(project_id, response?.compile?.outputFiles)
|
||||
)
|
||||
|
||||
@@ -32,7 +32,13 @@ module.exports = ClsiManager =
|
||||
json: req
|
||||
jar: false
|
||||
}, (error, response, body) ->
|
||||
callback error, body
|
||||
return callback(error) if error?
|
||||
if 200 <= response.statusCode < 300
|
||||
callback null, body
|
||||
else
|
||||
error = new Error("CLSI returned non-success code: #{response.statusCode}")
|
||||
logger.error err: error, project_id: project_id, "CLSI returned failure code"
|
||||
callback error, body
|
||||
|
||||
_parseOutputFiles: (project_id, rawOutputFiles = []) ->
|
||||
outputFiles = []
|
||||
|
||||
@@ -31,10 +31,10 @@ module.exports = CompileManager =
|
||||
return callback(error) if error?
|
||||
DocumentUpdaterHandler.flushProjectToMongo project_id, (error) ->
|
||||
return callback(error) if error?
|
||||
ClsiManager.sendRequest project_id, (error, success, outputFiles) ->
|
||||
ClsiManager.sendRequest project_id, (error, status, outputFiles) ->
|
||||
return callback(error) if error?
|
||||
logger.log files: outputFiles, "output files"
|
||||
callback(null, success, outputFiles)
|
||||
callback(null, status, outputFiles)
|
||||
|
||||
getLogLines: (project_id, callback)->
|
||||
Metrics.inc "editor.raw-logs"
|
||||
|
||||
@@ -322,7 +322,8 @@ module.exports = class Router
|
||||
|
||||
client.on 'pdfProject', (opts, callback)->
|
||||
AuthorizationManager.ensureClientCanViewProject client, (error, project_id) =>
|
||||
CompileManager.compile(project_id, user._id, opts, callback)
|
||||
CompileManager.compile project_id, user._id, opts, (error, status, outputFiles) ->
|
||||
return callback error, status == "success", outputFiles
|
||||
|
||||
client.on 'enableversioningController', (callback)->
|
||||
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
||||
|
||||
Reference in New Issue
Block a user