Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the error message in the slices #555

Merged
merged 2 commits into from
Jun 21, 2016

Conversation

x4base
Copy link
Contributor

@x4base x4base commented Jun 2, 2016

No description provided.

@coveralls
Copy link

coveralls commented Jun 2, 2016

Coverage Status

Coverage remained the same at 82.095% when pulling 0af373cb755fdb377fc795ae4d962e12974fa9d2 on x4base:slice_error_msg into cb384d0 on airbnb:master.

@mistercrunch
Copy link
Member

I like the idea of improving the error messages but we should allow for both custom message and this introspection of the web response. What about slice.error receives both message and response and we print a nice div (perhaps expandable, with more details) depending on what is provided by the user?

@x4base
Copy link
Contributor Author

x4base commented Jun 3, 2016

Do you mean something like this?

      getErrorMsg: function (xhr) {
        if (xhr.statusText === "timeout") {
          return "The request timed out";
        }
        var msg = "";
        if (!xhr.responseText) {
          var status = xhr.status;
          msg += "An unknown error occurred. (Status: " + status + ")";
          if (status === 0) {
            // This may happen when the worker in gunicorn times out
            msg += " Maybe the request timed out?";
          }
        }
        return msg;
      },

, then

-      error: function (msg) {
+      error: function (msg, xhr) {
         token.find("img.loading").hide();
-        var err = '<div class="alert alert-danger">' + msg + '</div>';
+        var err = msg ? ('<div class="alert alert-danger">' + msg + '</div>')
+            : "";
+        err += '<div class="alert alert-danger">' + this.getErrorMsg(xhr) + '</div>';
         container.html(err);
         container.show();

@mistercrunch
Copy link
Member

Yeah that looks right.

@coveralls
Copy link

coveralls commented Jun 4, 2016

Coverage Status

Coverage decreased (-0.2%) to 81.856% when pulling d5fca084397e61fe0fded8039715b497abf80807 on x4base:slice_error_msg into cb384d0 on airbnb:master.

@x4base
Copy link
Contributor Author

x4base commented Jun 8, 2016

I have updated the branch

@x4base x4base force-pushed the slice_error_msg branch from d5fca08 to b17e00f Compare June 21, 2016 06:45
@x4base
Copy link
Contributor Author

x4base commented Jun 21, 2016

Updated again to solve the conflict

@coveralls
Copy link

coveralls commented Jun 21, 2016

Coverage Status

Coverage remained the same at 81.627% when pulling b17e00f on x4base:slice_error_msg into d71a67c on airbnb:master.

@mistercrunch mistercrunch merged commit 40e1787 into apache:master Jun 21, 2016
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 17, 2021
* feat: add function to wrap api calls

* feat: add function to wrap api calls with returned type

* fix: remove deprecated

* fix: rename

* test: add unit test

* test: add unit tests
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 24, 2021
* feat: add function to wrap api calls

* feat: add function to wrap api calls with returned type

* fix: remove deprecated

* fix: rename

* test: add unit test

* test: add unit tests
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 25, 2021
* feat: add function to wrap api calls

* feat: add function to wrap api calls with returned type

* fix: remove deprecated

* fix: rename

* test: add unit test

* test: add unit tests
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this pull request Nov 26, 2021
* feat: add function to wrap api calls

* feat: add function to wrap api calls with returned type

* fix: remove deprecated

* fix: rename

* test: add unit test

* test: add unit tests
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.10.0 labels Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants