You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/05/06 16:52:15 UTC
[GitHub] [incubator-superset] etr2460 opened a new pull request #9753: feat: convert backend chart errors to the new error type
etr2460 opened a new pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753
### CATEGORY
Choose one
- [ ] Bug Fix
- [x] Enhancement (new features, refinement)
- [x] Refactor
- [ ] Add tests
- [ ] Build / Development Environment
- [ ] Documentation
### SUMMARY
Continuing to implement SIP-40, this time adding some of the backend logic. My plan is as follows:
- Start replacing the `error` field in api responses with the `errors` list of SupersetError Objects
- Support backwards compatibility on the frontend by pulling the message out of the `errors` list into the `error` field again
- Provide the necessary info to the front end to render better error messages once designs are ready
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
No ui changes
### TEST PLAN
Test dashboards loading with and without errors in charts, see errors still render properly
Test SQL Lab with and without query errors
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] Has associated issue:
- [ ] Changes UI
- [ ] Requires DB Migration.
- [ ] Confirm DB Migration upgrade and downgrade tested.
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
### REVIEWERS
to: @john-bodley @villebro @dpgaspar
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io edited a comment on pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#issuecomment-624795472
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=h1) Report
> Merging [#9753](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/3a213916c47073abb8168c485c72c3d439e152a8&el=desc) will **decrease** coverage by `0.00%`.
> The diff coverage is `75.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/9753/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #9753 +/- ##
==========================================
- Coverage 70.81% 70.81% -0.01%
==========================================
Files 586 587 +1
Lines 30442 30476 +34
Branches 3120 3121 +1
==========================================
+ Hits 21558 21582 +24
- Misses 8770 8780 +10
Partials 114 114
```
| Flag | Coverage Δ | |
|---|---|---|
| #cypress | `53.62% <0.00%> (-0.11%)` | :arrow_down: |
| #javascript | `59.09% <100.00%> (+0.02%)` | :arrow_up: |
| #python | `70.95% <74.00%> (+0.01%)` | :arrow_up: |
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [superset-frontend/src/chart/Chart.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L0NoYXJ0LmpzeA==) | `66.66% <ø> (ø)` | |
| [...rset-frontend/src/components/ErrorMessage/types.ts](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JNZXNzYWdlL3R5cGVzLnRz) | `100.00% <ø> (+100.00%)` | :arrow_up: |
| [superset/viz\_sip38.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6X3NpcDM4LnB5) | `0.00% <0.00%> (ø)` | |
| [superset/views/datasource.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YXNvdXJjZS5weQ==) | `93.33% <50.00%> (ø)` | |
| [superset/viz.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `71.44% <50.00%> (-0.06%)` | :arrow_down: |
| [...uperset-frontend/src/utils/getClientErrorObject.ts](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3V0aWxzL2dldENsaWVudEVycm9yT2JqZWN0LnRz) | `83.33% <100.00%> (+1.19%)` | :arrow_up: |
| [superset/connectors/sqla/models.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | `88.56% <100.00%> (ø)` | |
| [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `87.96% <100.00%> (+0.17%)` | :arrow_up: |
| [superset/errors.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZXJyb3JzLnB5) | `100.00% <100.00%> (ø)` | |
| [superset/models/helpers.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvbW9kZWxzL2hlbHBlcnMucHk=) | `87.95% <100.00%> (+0.06%)` | :arrow_up: |
| ... and [6 more](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=footer). Last update [3a21391...316a1db](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] john-bodley commented on a change in pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
john-bodley commented on a change in pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#discussion_r421198521
##########
File path: superset/models/helpers.py
##########
@@ -374,13 +374,20 @@ class QueryResult: # pylint: disable=too-few-public-methods
"""Object returned by the query interface"""
def __init__( # pylint: disable=too-many-arguments
- self, df, query, duration, status=QueryStatus.SUCCESS, error_message=None
+ self,
+ df,
+ query,
+ duration,
+ status=QueryStatus.SUCCESS,
+ error_message=None,
+ errors=None,
):
self.df: pd.DataFrame = df
self.query: str = query
self.duration: int = duration
self.status: str = status
self.error_message: Optional[str] = error_message
+ self.errors: Optional[List[Dict[str, Any]]] = errors
Review comment:
@etr2460 sorry this could be
```python
self.errors: List[Dict[str, Any]] = errors or []
```
which simplifies the related content.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io edited a comment on pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#issuecomment-624795472
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=h1) Report
> Merging [#9753](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/3a213916c47073abb8168c485c72c3d439e152a8&el=desc) will **decrease** coverage by `0.00%`.
> The diff coverage is `75.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/9753/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #9753 +/- ##
==========================================
- Coverage 70.81% 70.81% -0.01%
==========================================
Files 586 587 +1
Lines 30442 30476 +34
Branches 3120 3121 +1
==========================================
+ Hits 21558 21582 +24
- Misses 8770 8780 +10
Partials 114 114
```
| Flag | Coverage Δ | |
|---|---|---|
| #cypress | `53.62% <0.00%> (-0.11%)` | :arrow_down: |
| #javascript | `59.09% <100.00%> (+0.02%)` | :arrow_up: |
| #python | `70.95% <74.00%> (+0.01%)` | :arrow_up: |
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [superset-frontend/src/chart/Chart.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L0NoYXJ0LmpzeA==) | `66.66% <ø> (ø)` | |
| [...rset-frontend/src/components/ErrorMessage/types.ts](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JNZXNzYWdlL3R5cGVzLnRz) | `100.00% <ø> (+100.00%)` | :arrow_up: |
| [superset/viz\_sip38.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6X3NpcDM4LnB5) | `0.00% <0.00%> (ø)` | |
| [superset/views/datasource.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YXNvdXJjZS5weQ==) | `93.33% <50.00%> (ø)` | |
| [superset/viz.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `71.44% <50.00%> (-0.06%)` | :arrow_down: |
| [...uperset-frontend/src/utils/getClientErrorObject.ts](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3V0aWxzL2dldENsaWVudEVycm9yT2JqZWN0LnRz) | `83.33% <100.00%> (+1.19%)` | :arrow_up: |
| [superset/connectors/sqla/models.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | `88.56% <100.00%> (ø)` | |
| [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `87.96% <100.00%> (+0.17%)` | :arrow_up: |
| [superset/errors.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZXJyb3JzLnB5) | `100.00% <100.00%> (ø)` | |
| [superset/models/helpers.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvbW9kZWxzL2hlbHBlcnMucHk=) | `87.95% <100.00%> (+0.06%)` | :arrow_up: |
| ... and [6 more](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=footer). Last update [3a21391...316a1db](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io commented on pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#issuecomment-624795472
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=h1) Report
> Merging [#9753](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/5d167afb9499d7ce30c7ea763b19993af347dc23&el=desc) will **increase** coverage by `0.02%`.
> The diff coverage is `88.09%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/9753/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #9753 +/- ##
==========================================
+ Coverage 70.72% 70.74% +0.02%
==========================================
Files 584 184 -400
Lines 30382 17881 -12501
Branches 3112 0 -3112
==========================================
- Hits 21487 12650 -8837
+ Misses 8781 5231 -3550
+ Partials 114 0 -114
```
| Flag | Coverage Δ | |
|---|---|---|
| #cypress | `?` | |
| #javascript | `?` | |
| #python | `70.74% <88.09%> (-0.14%)` | :arrow_down: |
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [superset/views/datasource.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YXNvdXJjZS5weQ==) | `93.33% <50.00%> (ø)` | |
| [superset/viz.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `71.36% <50.00%> (-0.13%)` | :arrow_down: |
| [superset/connectors/sqla/models.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | `88.41% <100.00%> (-0.16%)` | :arrow_down: |
| [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `87.96% <100.00%> (+0.17%)` | :arrow_up: |
| [superset/errors.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZXJyb3JzLnB5) | `100.00% <100.00%> (ø)` | |
| [superset/models/helpers.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvbW9kZWxzL2hlbHBlcnMucHk=) | `87.95% <100.00%> (+0.06%)` | :arrow_up: |
| [superset/views/base.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvYmFzZS5weQ==) | `72.35% <100.00%> (ø)` | |
| [superset/views/core.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvY29yZS5weQ==) | `74.90% <100.00%> (-0.23%)` | :arrow_down: |
| [superset/views/database/mixins.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `58.92% <0.00%> (-21.43%)` | :arrow_down: |
| [superset/utils/cache.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdXRpbHMvY2FjaGUucHk=) | `45.83% <0.00%> (-20.84%)` | :arrow_down: |
| ... and [416 more](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=footer). Last update [5d167af...d00f6dd](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io edited a comment on pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#issuecomment-624795472
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=h1) Report
> Merging [#9753](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/3a213916c47073abb8168c485c72c3d439e152a8&el=desc) will **decrease** coverage by `0.00%`.
> The diff coverage is `75.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/9753/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #9753 +/- ##
==========================================
- Coverage 70.81% 70.81% -0.01%
==========================================
Files 586 587 +1
Lines 30442 30476 +34
Branches 3120 3121 +1
==========================================
+ Hits 21558 21582 +24
- Misses 8770 8780 +10
Partials 114 114
```
| Flag | Coverage Δ | |
|---|---|---|
| #cypress | `53.62% <0.00%> (-0.11%)` | :arrow_down: |
| #javascript | `59.09% <100.00%> (+0.02%)` | :arrow_up: |
| #python | `70.95% <74.00%> (+0.01%)` | :arrow_up: |
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [superset-frontend/src/chart/Chart.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L0NoYXJ0LmpzeA==) | `66.66% <ø> (ø)` | |
| [...rset-frontend/src/components/ErrorMessage/types.ts](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JNZXNzYWdlL3R5cGVzLnRz) | `100.00% <ø> (+100.00%)` | :arrow_up: |
| [superset/viz\_sip38.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6X3NpcDM4LnB5) | `0.00% <0.00%> (ø)` | |
| [superset/views/datasource.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YXNvdXJjZS5weQ==) | `93.33% <50.00%> (ø)` | |
| [superset/viz.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `71.44% <50.00%> (-0.06%)` | :arrow_down: |
| [...uperset-frontend/src/utils/getClientErrorObject.ts](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3V0aWxzL2dldENsaWVudEVycm9yT2JqZWN0LnRz) | `83.33% <100.00%> (+1.19%)` | :arrow_up: |
| [superset/connectors/sqla/models.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | `88.56% <100.00%> (ø)` | |
| [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `87.96% <100.00%> (+0.17%)` | :arrow_up: |
| [superset/errors.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZXJyb3JzLnB5) | `100.00% <100.00%> (ø)` | |
| [superset/models/helpers.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvbW9kZWxzL2hlbHBlcnMucHk=) | `87.95% <100.00%> (+0.06%)` | :arrow_up: |
| ... and [6 more](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=footer). Last update [3a21391...316a1db](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] graceguo-supercat commented on a change in pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
graceguo-supercat commented on a change in pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#discussion_r434902313
##########
File path: superset-frontend/src/utils/getClientErrorObject.ts
##########
@@ -48,6 +50,12 @@ export default function getClientErrorObject(
.json()
.then(errorJson => {
let error = { ...responseObject, ...errorJson };
+
+ // Backwards compatibility for old error renderers with the new error object
+ if (error.errors && error.errors.length > 0) {
Review comment:
I suspect this new line cause some error_details logged as empty.
this is how front-end use error field:
https://github.com/apache/incubator-superset/blob/38a6bd79da2be8c13a89a5f67f77faeb55c4e08b/superset-frontend/src/chart/chartAction.js#L403
Can you check what is in err.errors[0].message?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] john-bodley commented on a change in pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
john-bodley commented on a change in pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#discussion_r421197728
##########
File path: superset/viz.py
##########
@@ -460,8 +462,19 @@ def get_df_payload(self, query_obj=None, **kwargs):
is_loaded = True
except Exception as ex:
logger.exception(ex)
- if not self.error_message:
- self.error_message = "{}".format(ex)
+
+ error = dataclasses.asdict(
+ SupersetError(
+ message="{}".format(ex),
+ level=ErrorLevel.ERROR,
+ type=SupersetErrorType.VIZ_GET_DF_ERROR,
+ extra={},
+ )
+ )
+ if not self.errors:
Review comment:
@etr2460 apologies if I'm misreading the logic but isn't `self.errors` going to be a list by default and thus rather than:
```python
if not self.errors:
self.errors = [error]
else:
self.errors.append(error)
```
this could be:
```python
self.errors.append(error)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] john-bodley commented on a change in pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
john-bodley commented on a change in pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#discussion_r421198521
##########
File path: superset/models/helpers.py
##########
@@ -374,13 +374,20 @@ class QueryResult: # pylint: disable=too-few-public-methods
"""Object returned by the query interface"""
def __init__( # pylint: disable=too-many-arguments
- self, df, query, duration, status=QueryStatus.SUCCESS, error_message=None
+ self,
+ df,
+ query,
+ duration,
+ status=QueryStatus.SUCCESS,
+ error_message=None,
+ errors=None,
):
self.df: pd.DataFrame = df
self.query: str = query
self.duration: int = duration
self.status: str = status
self.error_message: Optional[str] = error_message
+ self.errors: Optional[List[Dict[str, Any]]] = errors
Review comment:
@etr2460 sorry this could be:
```python
self.errors: List[Dict[str, Any]] = errors or []
```
which simplifies the related content in `viz.py`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] john-bodley commented on a change in pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
john-bodley commented on a change in pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#discussion_r420945670
##########
File path: setup.cfg
##########
@@ -45,7 +45,7 @@ combine_as_imports = true
include_trailing_comma = true
line_length = 88
known_first_party = superset
-known_third_party =alembic,apispec,backoff,bleach,celery,click,colorama,contextlib2,croniter,cryptography,dataclasses,dateutil,flask,flask_appbuilder,flask_babel,flask_caching,flask_compress,flask_login,flask_migrate,flask_sqlalchemy,flask_talisman,flask_testing,flask_wtf,geohash,geopy,humanize,isodate,jinja2,markdown,markupsafe,marshmallow,msgpack,numpy,pandas,parsedatetime,pathlib2,polyline,prison,pyarrow,pyhive,pytz,retry,selenium,setuptools,simplejson,sphinx_rtd_theme,sqlalchemy,sqlalchemy_utils,sqlparse,werkzeug,wtforms,wtforms_json,yaml
+known_third_party =alembic,apispec,backoff,bleach,celery,click,colorama,contextlib2,croniter,cryptography,dateutil,flask,flask_appbuilder,flask_babel,flask_caching,flask_compress,flask_login,flask_migrate,flask_sqlalchemy,flask_talisman,flask_testing,flask_wtf,geohash,geopy,humanize,isodate,jinja2,markdown,markupsafe,marshmallow,msgpack,numpy,pandas,parsedatetime,pathlib2,polyline,prison,pyarrow,pyhive,pytz,retry,selenium,setuptools,simplejson,sphinx_rtd_theme,sqlalchemy,sqlalchemy_utils,sqlparse,werkzeug,wtforms,wtforms_json,yaml
Review comment:
`dataclasses` should be included here as it's not part of the `stdlib` in Python 3.6.
##########
File path: superset/errors.py
##########
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from dataclasses import dataclass
+from enum import Enum
+from typing import Any, Dict
+
+
+class SupersetErrorType(str, Enum):
+ """
+ Types of errors that can exist within Superset.
+
+ Keep in sync with superset-frontend/src/components/ErrorMessage/types.ts
+ """
+
+ FRONTEND_CSRF_ERROR = "FRONTEND_CSRF_ERROR"
+ FRONTEND_NETWORK_ERROR = "FRONTEND_NETWORK_ERROR"
+ FRONTEND_TIMEOUT_ERROR = "FRONTEND_TIMEOUT_ERROR"
+
Review comment:
Nit. Nix empty lines?
##########
File path: superset-frontend/src/components/ErrorMessage/types.ts
##########
@@ -17,18 +17,22 @@
* under the License.
*/
-// TODO: Add more error types as we classify more errors
+// Keep in sync with superset/views/errors.py
export const ErrorTypeEnum = {
- // Generic errors created on the frontend
FRONTEND_CSRF_ERROR: 'FRONTEND_CSRF_ERROR',
FRONTEND_NETWORK_ERROR: 'FRONTEND_NETWORK_ERROR',
FRONTEND_TIMEOUT_ERROR: 'FRONTEND_TIMEOUT_ERROR',
+
Review comment:
Nit. Nix empty lines?
##########
File path: superset/errors.py
##########
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from dataclasses import dataclass
+from enum import Enum
+from typing import Any, Dict
+
+
+class SupersetErrorType(str, Enum):
+ """
+ Types of errors that can exist within Superset.
+
+ Keep in sync with superset-frontend/src/components/ErrorMessage/types.ts
+ """
+
+ FRONTEND_CSRF_ERROR = "FRONTEND_CSRF_ERROR"
+ FRONTEND_NETWORK_ERROR = "FRONTEND_NETWORK_ERROR"
+ FRONTEND_TIMEOUT_ERROR = "FRONTEND_TIMEOUT_ERROR"
+
+ GENERIC_DB_ENGINE_ERROR = "GENERIC_DB_ENGINE_ERROR"
+
+ VIZ_GET_DF_ERROR = "VIZ_GET_DF_ERROR"
+
+
+class ErrorLevel(str, Enum):
+ """
+ Levels of errors that can exist within Superset.
+
+ Keep in sync with superset-frontend/src/components/ErrorMessage/types.ts
+ """
+
+ INFO = "info"
+ WARNING = "warning"
+ ERROR = "error"
+
+
+@dataclass
+class SupersetError:
+ """
+ An error that is returned to a client.
+ """
+
+ message: str
+ error_type: SupersetErrorType
+ level: ErrorLevel
+ extra: Dict[str, Any]
Review comment:
Do you want to make this optional?
##########
File path: superset/viz.py
##########
@@ -460,8 +462,19 @@ def get_df_payload(self, query_obj=None, **kwargs):
is_loaded = True
except Exception as ex:
logger.exception(ex)
- if not self.error_message:
- self.error_message = "{}".format(ex)
+
+ error = dataclasses.asdict(
+ SupersetError(
+ message="{}".format(ex),
+ level=ErrorLevel.ERROR,
+ type=SupersetErrorType.VIZ_GET_DF_ERROR,
+ extra={},
Review comment:
See note regarding making this optional.
##########
File path: superset/viz.py
##########
@@ -460,8 +462,19 @@ def get_df_payload(self, query_obj=None, **kwargs):
is_loaded = True
except Exception as ex:
logger.exception(ex)
- if not self.error_message:
- self.error_message = "{}".format(ex)
+
+ error = dataclasses.asdict(
+ SupersetError(
+ message="{}".format(ex),
Review comment:
Why not `message=str(ex)`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io edited a comment on pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#issuecomment-624795472
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=h1) Report
> Merging [#9753](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/3a213916c47073abb8168c485c72c3d439e152a8&el=desc) will **decrease** coverage by `0.00%`.
> The diff coverage is `75.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/9753/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #9753 +/- ##
==========================================
- Coverage 70.81% 70.81% -0.01%
==========================================
Files 586 587 +1
Lines 30442 30476 +34
Branches 3120 3121 +1
==========================================
+ Hits 21558 21582 +24
- Misses 8770 8780 +10
Partials 114 114
```
| Flag | Coverage Δ | |
|---|---|---|
| #cypress | `53.62% <0.00%> (-0.11%)` | :arrow_down: |
| #javascript | `59.09% <100.00%> (+0.02%)` | :arrow_up: |
| #python | `70.95% <74.00%> (+0.01%)` | :arrow_up: |
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [superset-frontend/src/chart/Chart.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L0NoYXJ0LmpzeA==) | `66.66% <ø> (ø)` | |
| [...rset-frontend/src/components/ErrorMessage/types.ts](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JNZXNzYWdlL3R5cGVzLnRz) | `100.00% <ø> (+100.00%)` | :arrow_up: |
| [superset/viz\_sip38.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6X3NpcDM4LnB5) | `0.00% <0.00%> (ø)` | |
| [superset/views/datasource.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YXNvdXJjZS5weQ==) | `93.33% <50.00%> (ø)` | |
| [superset/viz.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `71.44% <50.00%> (-0.06%)` | :arrow_down: |
| [...uperset-frontend/src/utils/getClientErrorObject.ts](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3V0aWxzL2dldENsaWVudEVycm9yT2JqZWN0LnRz) | `83.33% <100.00%> (+1.19%)` | :arrow_up: |
| [superset/connectors/sqla/models.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | `88.56% <100.00%> (ø)` | |
| [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `87.96% <100.00%> (+0.17%)` | :arrow_up: |
| [superset/errors.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZXJyb3JzLnB5) | `100.00% <100.00%> (ø)` | |
| [superset/models/helpers.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvbW9kZWxzL2hlbHBlcnMucHk=) | `87.95% <100.00%> (+0.06%)` | :arrow_up: |
| ... and [6 more](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=footer). Last update [3a21391...316a1db](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] etr2460 commented on a change in pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
etr2460 commented on a change in pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#discussion_r422268409
##########
File path: superset/models/helpers.py
##########
@@ -374,13 +374,20 @@ class QueryResult: # pylint: disable=too-few-public-methods
"""Object returned by the query interface"""
def __init__( # pylint: disable=too-many-arguments
- self, df, query, duration, status=QueryStatus.SUCCESS, error_message=None
+ self,
+ df,
+ query,
+ duration,
+ status=QueryStatus.SUCCESS,
+ error_message=None,
+ errors=None,
):
self.df: pd.DataFrame = df
self.query: str = query
self.duration: int = duration
self.status: str = status
self.error_message: Optional[str] = error_message
+ self.errors: Optional[List[Dict[str, Any]]] = errors
Review comment:
I actually think it's better to keep this optional? Because at the end of the day we send `errors` down to the client, and i think it being null is better than `[]`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] etr2460 commented on a change in pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
etr2460 commented on a change in pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#discussion_r420968755
##########
File path: superset-frontend/src/components/ErrorMessage/types.ts
##########
@@ -17,18 +17,22 @@
* under the License.
*/
-// TODO: Add more error types as we classify more errors
+// Keep in sync with superset/views/errors.py
export const ErrorTypeEnum = {
- // Generic errors created on the frontend
FRONTEND_CSRF_ERROR: 'FRONTEND_CSRF_ERROR',
FRONTEND_NETWORK_ERROR: 'FRONTEND_NETWORK_ERROR',
FRONTEND_TIMEOUT_ERROR: 'FRONTEND_TIMEOUT_ERROR',
+
Review comment:
I put the empty lines here to try and organize these errors into categories, since i expect there to be many of them going forward
##########
File path: superset/viz.py
##########
@@ -460,8 +462,19 @@ def get_df_payload(self, query_obj=None, **kwargs):
is_loaded = True
except Exception as ex:
logger.exception(ex)
- if not self.error_message:
- self.error_message = "{}".format(ex)
+
+ error = dataclasses.asdict(
+ SupersetError(
+ message="{}".format(ex),
Review comment:
this was copy pasted from before, i assume `str(ex)` works the same way, so i'll change it
##########
File path: superset/errors.py
##########
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from dataclasses import dataclass
+from enum import Enum
+from typing import Any, Dict
+
+
+class SupersetErrorType(str, Enum):
+ """
+ Types of errors that can exist within Superset.
+
+ Keep in sync with superset-frontend/src/components/ErrorMessage/types.ts
+ """
+
+ FRONTEND_CSRF_ERROR = "FRONTEND_CSRF_ERROR"
+ FRONTEND_NETWORK_ERROR = "FRONTEND_NETWORK_ERROR"
+ FRONTEND_TIMEOUT_ERROR = "FRONTEND_TIMEOUT_ERROR"
+
+ GENERIC_DB_ENGINE_ERROR = "GENERIC_DB_ENGINE_ERROR"
+
+ VIZ_GET_DF_ERROR = "VIZ_GET_DF_ERROR"
+
+
+class ErrorLevel(str, Enum):
+ """
+ Levels of errors that can exist within Superset.
+
+ Keep in sync with superset-frontend/src/components/ErrorMessage/types.ts
+ """
+
+ INFO = "info"
+ WARNING = "warning"
+ ERROR = "error"
+
+
+@dataclass
+class SupersetError:
+ """
+ An error that is returned to a client.
+ """
+
+ message: str
+ error_type: SupersetErrorType
+ level: ErrorLevel
+ extra: Dict[str, Any]
Review comment:
I went back and forth on that... I guess optional is probably safer in the long run, and means people don't need to remember to initialize with an empty dict, although it pushes a bit of work to the front end to check that the object exists
##########
File path: superset/viz.py
##########
@@ -460,8 +462,19 @@ def get_df_payload(self, query_obj=None, **kwargs):
is_loaded = True
except Exception as ex:
logger.exception(ex)
- if not self.error_message:
- self.error_message = "{}".format(ex)
+
+ error = dataclasses.asdict(
+ SupersetError(
+ message="{}".format(ex),
+ level=ErrorLevel.ERROR,
+ type=SupersetErrorType.VIZ_GET_DF_ERROR,
+ extra={},
+ )
+ )
+ if not self.errors:
Review comment:
not sure how your previous comment would affect this
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] john-bodley commented on a change in pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
john-bodley commented on a change in pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#discussion_r420953042
##########
File path: superset/viz.py
##########
@@ -460,8 +462,19 @@ def get_df_payload(self, query_obj=None, **kwargs):
is_loaded = True
except Exception as ex:
logger.exception(ex)
- if not self.error_message:
- self.error_message = "{}".format(ex)
+
+ error = dataclasses.asdict(
+ SupersetError(
+ message="{}".format(ex),
+ level=ErrorLevel.ERROR,
+ type=SupersetErrorType.VIZ_GET_DF_ERROR,
+ extra={},
+ )
+ )
+ if not self.errors:
Review comment:
See previous comment which would simplify this to `self.errors.append(error)`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] etr2460 commented on a change in pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
etr2460 commented on a change in pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#discussion_r420942113
##########
File path: superset/views/datasource.py
##########
@@ -39,7 +39,7 @@ class Datasource(BaseSupersetView):
def save(self) -> Response:
data = request.form.get("data")
if not isinstance(data, str):
- return json_error_response("Request missing data field.", status="500")
+ return json_error_response("Request missing data field.", status=500)
Review comment:
cleaning up some typing
##########
File path: superset/errors.py
##########
@@ -0,0 +1,59 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from dataclasses import dataclass
+from enum import Enum
+from typing import Any, Dict
+
+
+class SupersetErrorType(str, Enum):
Review comment:
inheriting from `str` provides automatic json serialization
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io edited a comment on pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#issuecomment-624795472
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=h1) Report
> Merging [#9753](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/3a213916c47073abb8168c485c72c3d439e152a8&el=desc) will **decrease** coverage by `0.00%`.
> The diff coverage is `75.00%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/9753/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #9753 +/- ##
==========================================
- Coverage 70.81% 70.81% -0.01%
==========================================
Files 586 587 +1
Lines 30442 30476 +34
Branches 3120 3121 +1
==========================================
+ Hits 21558 21582 +24
- Misses 8770 8780 +10
Partials 114 114
```
| Flag | Coverage Δ | |
|---|---|---|
| #cypress | `53.62% <0.00%> (-0.11%)` | :arrow_down: |
| #javascript | `59.09% <100.00%> (+0.02%)` | :arrow_up: |
| #python | `70.95% <74.00%> (+0.01%)` | :arrow_up: |
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [superset-frontend/src/chart/Chart.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L0NoYXJ0LmpzeA==) | `66.66% <ø> (ø)` | |
| [...rset-frontend/src/components/ErrorMessage/types.ts](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JNZXNzYWdlL3R5cGVzLnRz) | `100.00% <ø> (+100.00%)` | :arrow_up: |
| [superset/viz\_sip38.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6X3NpcDM4LnB5) | `0.00% <0.00%> (ø)` | |
| [superset/views/datasource.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YXNvdXJjZS5weQ==) | `93.33% <50.00%> (ø)` | |
| [superset/viz.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `71.44% <50.00%> (-0.06%)` | :arrow_down: |
| [...uperset-frontend/src/utils/getClientErrorObject.ts](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3V0aWxzL2dldENsaWVudEVycm9yT2JqZWN0LnRz) | `83.33% <100.00%> (+1.19%)` | :arrow_up: |
| [superset/connectors/sqla/models.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | `88.56% <100.00%> (ø)` | |
| [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `87.96% <100.00%> (+0.17%)` | :arrow_up: |
| [superset/errors.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZXJyb3JzLnB5) | `100.00% <100.00%> (ø)` | |
| [superset/models/helpers.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvbW9kZWxzL2hlbHBlcnMucHk=) | `87.95% <100.00%> (+0.06%)` | :arrow_up: |
| ... and [6 more](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=footer). Last update [3a21391...316a1db](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io edited a comment on pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#issuecomment-624795472
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=h1) Report
> Merging [#9753](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/5d167afb9499d7ce30c7ea763b19993af347dc23&el=desc) will **decrease** coverage by `4.68%`.
> The diff coverage is `88.63%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/9753/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #9753 +/- ##
==========================================
- Coverage 70.72% 66.03% -4.69%
==========================================
Files 584 587 +3
Lines 30382 30470 +88
Branches 3112 3118 +6
==========================================
- Hits 21487 20122 -1365
- Misses 8781 10165 +1384
- Partials 114 183 +69
```
| Flag | Coverage Δ | |
|---|---|---|
| #cypress | `?` | |
| #javascript | `59.04% <100.00%> (+0.13%)` | :arrow_up: |
| #python | `70.96% <88.09%> (+0.08%)` | :arrow_up: |
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [superset-frontend/src/chart/Chart.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L0NoYXJ0LmpzeA==) | `10.41% <ø> (-56.25%)` | :arrow_down: |
| [...rset-frontend/src/components/ErrorMessage/types.ts](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JNZXNzYWdlL3R5cGVzLnRz) | `100.00% <ø> (+100.00%)` | :arrow_up: |
| [superset/views/datasource.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YXNvdXJjZS5weQ==) | `93.33% <50.00%> (ø)` | |
| [superset/viz.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `71.36% <50.00%> (-0.13%)` | :arrow_down: |
| [...uperset-frontend/src/utils/getClientErrorObject.ts](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3V0aWxzL2dldENsaWVudEVycm9yT2JqZWN0LnRz) | `83.33% <100.00%> (+1.19%)` | :arrow_up: |
| [superset/connectors/sqla/models.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | `88.56% <100.00%> (ø)` | |
| [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `87.96% <100.00%> (+0.17%)` | :arrow_up: |
| [superset/errors.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZXJyb3JzLnB5) | `100.00% <100.00%> (ø)` | |
| [superset/models/helpers.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvbW9kZWxzL2hlbHBlcnMucHk=) | `87.95% <100.00%> (+0.06%)` | :arrow_up: |
| [superset/views/base.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvYmFzZS5weQ==) | `72.35% <100.00%> (ø)` | |
| ... and [161 more](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=footer). Last update [5d167af...d00f6dd](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] codecov-io edited a comment on pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#issuecomment-624795472
# [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=h1) Report
> Merging [#9753](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-superset/commit/5d167afb9499d7ce30c7ea763b19993af347dc23&el=desc) will **increase** coverage by `0.09%`.
> The diff coverage is `88.63%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/incubator-superset/pull/9753/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l)](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #9753 +/- ##
==========================================
+ Coverage 70.72% 70.81% +0.09%
==========================================
Files 584 587 +3
Lines 30382 30470 +88
Branches 3112 3118 +6
==========================================
+ Hits 21487 21577 +90
+ Misses 8781 8780 -1
+ Partials 114 113 -1
```
| Flag | Coverage Δ | |
|---|---|---|
| #cypress | `53.64% <0.00%> (+0.06%)` | :arrow_up: |
| #javascript | `59.04% <100.00%> (+0.13%)` | :arrow_up: |
| #python | `70.96% <88.09%> (+0.08%)` | :arrow_up: |
| [Impacted Files](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [superset-frontend/src/chart/Chart.jsx](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NoYXJ0L0NoYXJ0LmpzeA==) | `66.66% <ø> (ø)` | |
| [...rset-frontend/src/components/ErrorMessage/types.ts](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRXJyb3JNZXNzYWdlL3R5cGVzLnRz) | `100.00% <ø> (+100.00%)` | :arrow_up: |
| [superset/views/datasource.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YXNvdXJjZS5weQ==) | `93.33% <50.00%> (ø)` | |
| [superset/viz.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdml6LnB5) | `71.36% <50.00%> (-0.13%)` | :arrow_down: |
| [...uperset-frontend/src/utils/getClientErrorObject.ts](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3V0aWxzL2dldENsaWVudEVycm9yT2JqZWN0LnRz) | `83.33% <100.00%> (+1.19%)` | :arrow_up: |
| [superset/connectors/sqla/models.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | `88.56% <100.00%> (ø)` | |
| [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `87.96% <100.00%> (+0.17%)` | :arrow_up: |
| [superset/errors.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZXJyb3JzLnB5) | `100.00% <100.00%> (ø)` | |
| [superset/models/helpers.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvbW9kZWxzL2hlbHBlcnMucHk=) | `87.95% <100.00%> (+0.06%)` | :arrow_up: |
| [superset/views/base.py](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvYmFzZS5weQ==) | `72.35% <100.00%> (ø)` | |
| ... and [22 more](https://codecov.io/gh/apache/incubator-superset/pull/9753/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=footer). Last update [5d167af...d00f6dd](https://codecov.io/gh/apache/incubator-superset/pull/9753?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [incubator-superset] graceguo-supercat commented on a change in pull request #9753: feat: convert backend chart errors to the new error type
Posted by GitBox <gi...@apache.org>.
graceguo-supercat commented on a change in pull request #9753:
URL: https://github.com/apache/incubator-superset/pull/9753#discussion_r434902313
##########
File path: superset-frontend/src/utils/getClientErrorObject.ts
##########
@@ -48,6 +50,12 @@ export default function getClientErrorObject(
.json()
.then(errorJson => {
let error = { ...responseObject, ...errorJson };
+
+ // Backwards compatibility for old error renderers with the new error object
+ if (error.errors && error.errors.length > 0) {
Review comment:
I suspect this new line cause some error_details logged as empty.
this is how front-end use error field:
https://github.com/apache/incubator-superset/blob/38a6bd79da2be8c13a89a5f67f77faeb55c4e08b/superset-frontend/src/chart/chartAction.js#L403
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org