@@ -149,14 +149,23 @@ export default class RunestoneBase {
149149 ) ;
150150 throw new Error ( "Missing authentication token" ) ;
151151 }
152- throw new Error ( "Failed to save the log entry" ) ;
152+ throw new Error ( `Failed to save the log entry
153+ Status: ${ response . status } ` ) ;
153154 }
154155 post_return = response . json ( ) ;
155156 } catch ( e ) {
156- if ( this . isTimed ) {
157- alert ( `Error: Your action was not saved! The error was ${ e } ` ) ;
157+ let detail = "none" ;
158+ if ( post_return . detail ) {
159+ detail = post_return . detail ;
158160 }
159- console . log ( `Error: ${ e } ` ) ;
161+ if ( eBookConfig . loginRequired ) {
162+ alert ( `Error: Your action was not saved!
163+ The error was ${ e }
164+ Detail: ${ detail } .
165+ Please report this error!` ) ;
166+ }
167+ // send a request to save this error
168+ console . log ( `Error: ${ e } Detail: ${ detail } ` ) ;
160169 }
161170 return post_return ;
162171 }
@@ -187,9 +196,19 @@ export default class RunestoneBase {
187196 ) ;
188197 let response = await fetch ( request ) ;
189198 if ( ! response . ok ) {
190- throw new Error ( "Failed to log the run" ) ;
199+ post_promise = await response . json ( ) ;
200+ if ( eBookConfig . loginRequired ) {
201+ alert ( `Failed to save your code
202+ Status is ${ response . status }
203+ Detail: ${ post_promise . detail } ` ) ;
204+ } else {
205+ console . log (
206+ `Did not save the code. Status: ${ response . status } `
207+ ) ;
208+ }
209+ } else {
210+ post_promise = await response . json ( ) ;
191211 }
192- post_promise = await response . json ( ) ;
193212 }
194213 if ( ! this . isTimed || eBookConfig . debug ) {
195214 console . log ( "running " + JSON . stringify ( eventInfo ) ) ;
0 commit comments