Closed
Description
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'
);
- CANNOT_CONVERT_COLUMN_TYPE, already called by coerce_column
- 'DUPLICATE_TABLE_NAME', already called in add_shared_table
- 'DUPLICATE_TABLE_NAME', call in create_table?, our current behavior seems reasonable, we just take you to the pre-existing table
- 'IMPORT_FAILED', fixed in Datablock Storage: use UX expected enum values for StudentFacingError(:VALUE) #58765, called on import_csv
- 'KEY_INVALID', raise KEY_INVALID instead of MAX_KEY_LENGTH_EXCEEDED here, fixed in Datablock Storage: use UX expected enum values for StudentFacingError(:VALUE) #58765
- 'KEY_RENAMED', I believe this was only for compat during the dynamodb => firebase conversion
- 'MAX_TABLES_EXCEEDED', already raised by datablock_storage_table#validate_max_table_count
- 'TABLE_NAME_INVALID', fixed by Raise StudentFacingError.new(:TABLE_NAME_INVALID) if table name is too long #58764
- 'TABLE_RENAMED', I believe this was only for compat during the dynamodb => firebase conversion
Metadata
Metadata
Assignees
Labels
No labels