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

Raise expected VALUE for StudentFacingError(VALUE) #58762

Closed
9 tasks done
snickell opened this issue May 20, 2024 · 1 comment · Fixed by #58765
Closed
9 tasks done

Raise expected VALUE for StudentFacingError(VALUE) #58762

snickell opened this issue May 20, 2024 · 1 comment · Fixed by #58765

Comments

@snickell
Copy link
Contributor

snickell commented May 20, 2024

To get appropriate UX errors from Data Browser forms, we need to raise hardcoded VALUE for the StudentError.

Here's some from DataOverView.jsx for clicking the create table button: https://github.com/code-dot-org/code-dot-org/blob/84d65fa95b143fc2852b9bc53955d1d505fea094/apps/src/storage/dataBrowser/DataOverview.jsx/#L39-L42

          (error.type === WarningType.MAX_TABLES_EXCEEDED ||
            error.type === WarningType.TABLE_NAME_INVALID ||
            error.type === WarningType.TABLE_RENAMED ||
            error.type === WarningType.DUPLICATE_TABLE_NAME)

We can be sure the corresponding raise StudentError(VALUE) use one of these, like :TABLE_NAME_INVALID.

Another source of these errors would be the enum itselfl (https://github.com/code-dot-org/code-dot-org/blob/19368167d875b535d69e6dddcf0b7f3f11c2a79b/apps/src/storage/constants.js/#L5-L15):

export const WarningType = makeEnum(
  'CANNOT_CONVERT_COLUMN_TYPE',
  'DUPLICATE_TABLE_NAME',
  'IMPORT_FAILED',
  'KEY_INVALID',
  'KEY_RENAMED',
  'MAX_TABLES_EXCEEDED',
  'TABLE_NAME_INVALID',
  'TABLE_RENAMED'
);
@snickell
Copy link
Contributor Author

E.g. if we were to throw StudentError(:IMPORT_FAILED) when the CSV wasn't formatted the way we expect, this would trigger a UX warning, based on this code: https://github.com/code-dot-org/code-dot-org/blob/19368167d875b535d69e6dddcf0b7f3f11c2a79b/apps/src/storage/dataBrowser/DataTableView.jsx/#L59-L60

@snickell snickell changed the title Raise expected VALUE for StudentError(VALUE) Raise expected VALUE for StudentFacingError(VALUE) May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant