This repository has been archived by the owner on May 11, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Differentiate between error types when failing to load an exercise.
Summary: We used to only blame the user's internet. But it seems sometimes it is our fault too. So now we differentitate between the different errors, to be less confusing to users whose internet is not to blame, and to help devs debug any particular issue based upon what our users report. This is to fix: https://app.asana.com/0/27216215224639/71186369010999 Test Plan: git grep warnTimeout see that we weren't using this anywhere else. on dev khan exercise files if they exist get served directly. So to test we can change the name so that it uses the exercises/handler_raw.py. ``` diff --git a/khan-exercise.js b/khan-exercise.js index 8a9bcfd..eb048c3 100644 --- a/khan-exercise.js +++ b/khan-exercise.js @@ -2048,7 +2048,7 @@ function loadExercise(exerciseId, fileName) { debugLog("loadExercise start " + fileName); // Packing occurs on the server but at the same "exercises/" URL - $.get(urlBase + "exercises/" + fileName).done(function(data) { + $.ajax({url:urlBase + "exercises/Z" + fileName, timeout:1000}).done(function(data) { debugLog("loadExercise got " + fileName); // Get rid of any external scripts in data before we shove data ``` http://www.khanacademy.dev/math/arithmetic/addition-subtraction/basic_addition/e/addition_1 See 404 message. Then in webapp: ``` diff --git a/exercises/handler_raw.py b/exercises/handler_raw.py index 5aa90bd..03a1c8f 100644 --- a/exercises/handler_raw.py +++ b/exercises/handler_raw.py @@ -17,6 +17,8 @@ class RawExercise(request_handler.RequestHandler): would also cause problems for the a/b tests in exercises.file_experiments. """ + import time + time.sleep(5000) path = self.request.path filename = urllib.unquote(path.split('/', 3)[3]) ``` http://www.khanacademy.dev/math/arithmetic/addition-subtraction/basic_addition/e/addition_1 See timeout message. Then in webapp: ``` diff --git a/exercises/handler_raw.py b/exercises/handler_raw.py index 5aa90bd..9e1728a 100644 --- a/exercises/handler_raw.py +++ b/exercises/handler_raw.py @@ -17,6 +17,7 @@ class RawExercise(request_handler.RequestHandler): would also cause problems for the a/b tests in exercises.file_experiments. """ + 1/0 path = self.request.path filename = urllib.unquote(path.split('/', 3)[3]) ``` See the generic error message. Then in javascript console do: MathJax.Ajax.Require("some.js") See the MathJax error message mentioning some.js. Reviewers: emily, lauren Subscribers: kevindangoor Differential Revision: https://phabricator.khanacademy.org/D24180
- Loading branch information