Return more informative errors
This commit is contained in:
@@ -22,6 +22,6 @@ describe "Timed out compile", ->
|
||||
it "should return a timeout error", ->
|
||||
@body.compile.error.should.equal "container timed out"
|
||||
|
||||
it "should return a failure status", ->
|
||||
@body.compile.status.should.equal "failure"
|
||||
it "should return a timedout status", ->
|
||||
@body.compile.status.should.equal "timedout"
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ describe "CompileController", ->
|
||||
|
||||
it "should return the JSON response", ->
|
||||
@res.send
|
||||
.calledWith(JSON.stringify
|
||||
.calledWith(200,
|
||||
compile:
|
||||
status: "success"
|
||||
error: null
|
||||
@@ -83,14 +83,46 @@ describe "CompileController", ->
|
||||
|
||||
it "should return the JSON response with the error", ->
|
||||
@res.send
|
||||
.calledWith(JSON.stringify
|
||||
.calledWith(500,
|
||||
compile:
|
||||
status: "failure"
|
||||
status: "error"
|
||||
error: @message
|
||||
outputFiles: []
|
||||
)
|
||||
.should.equal true
|
||||
|
||||
describe "when the request times out", ->
|
||||
beforeEach ->
|
||||
@error = new Error(@message = "container timed out")
|
||||
@error.timedout = true
|
||||
@CompileManager.doCompile = sinon.stub().callsArgWith(1, @error, null)
|
||||
@CompileController.compile @req, @res
|
||||
|
||||
it "should return the JSON response with the timeout status", ->
|
||||
@res.send
|
||||
.calledWith(200,
|
||||
compile:
|
||||
status: "timedout"
|
||||
error: @message
|
||||
outputFiles: []
|
||||
)
|
||||
.should.equal true
|
||||
|
||||
describe "when the request returns no output files", ->
|
||||
beforeEach ->
|
||||
@CompileManager.doCompile = sinon.stub().callsArgWith(1, null, [])
|
||||
@CompileController.compile @req, @res
|
||||
|
||||
it "should return the JSON response with the failure status", ->
|
||||
@res.send
|
||||
.calledWith(200,
|
||||
compile:
|
||||
error: null
|
||||
status: "failure"
|
||||
outputFiles: []
|
||||
)
|
||||
.should.equal true
|
||||
|
||||
describe "syncFromCode", ->
|
||||
beforeEach ->
|
||||
@file = "main.tex"
|
||||
|
||||
Reference in New Issue
Block a user