Skip to content

Main loop and handling exceptions

vazexqi edited this page Feb 22, 2013 · 2 revisions

It is vital to wrap the main loop of your program with a try...catch block.

Assuming that one of your first lines is to poll the submission queue, there are several things that can happen in the grader:

  1. The host is down with a '502 - Internal Server Error'.
groovyx.net.http.HttpResponseException: Internal Server Error
        at groovyx.net.http.HTTPBuilder.defaultFailureHandler(HTTPBuilder.java:634) ~[http-builder-0.7-SNAPSHOT.jar:na]
  1. The queue is not accessible at that moment
  2. It returns a malformed response (text/html) that your parser just cannot parse
Caused by: groovy.json.JsonException: Lexing failed on line: 1, column: 1, while reading '<', no possible valid JSON value or punctuation could be recognized.
Clone this wiki locally