@@ -137,8 +137,15 @@ export default class RunestoneBase {
137137 if ( ! response . ok ) {
138138 if ( response . status === 422 ) {
139139 // Get details about why this is unprocesable.
140- post_return = await response . json ( )
141- console . log ( post_return . detail )
140+ post_return = await response . json ( ) ;
141+ console . log ( post_return . detail ) ;
142+ throw new Error ( "Unprocessable Request" ) ;
143+ } else if ( response . status == 401 ) {
144+ post_return = await response . json ( ) ;
145+ console . log (
146+ `Missing authentication token ${ post_return . detail } `
147+ ) ;
148+ throw new Error ( "Missing authentication token" ) ;
142149 }
143150 throw new Error ( "Failed to save the log entry" ) ;
144151 }
@@ -212,7 +219,10 @@ export default class RunestoneBase {
212219 this . checkServerComplete = new Promise ( function ( resolve , reject ) {
213220 self . csresolver = resolve ;
214221 } ) ;
215- if ( eBookConfig . isLoggedIn && ( this . useRunestoneServices || this . graderactive ) ) {
222+ if (
223+ eBookConfig . isLoggedIn &&
224+ ( this . useRunestoneServices || this . graderactive )
225+ ) {
216226 let data = { } ;
217227 data . div_id = this . divid ;
218228 data . course = eBookConfig . course ;
@@ -225,8 +235,10 @@ export default class RunestoneBase {
225235 if ( this . sid ) {
226236 data . sid = this . sid ;
227237 }
228- if ( ! ( data . div_id && data . course && data . event ) ) {
229- console . log ( `A required field is missing data ${ data . div_id } :${ data . course } :${ data . event } ` )
238+ if ( ! ( data . div_id && data . course && data . event ) ) {
239+ console . log (
240+ `A required field is missing data ${ data . div_id } :${ data . course } :${ data . event } `
241+ ) ;
230242 }
231243 // If we are NOT in practice mode and we are not in a peer exercise
232244 // and assessmentTaken is true
0 commit comments