Skip to content

Raise expected VALUE for StudentFacingError(VALUE) #58762

Closed
@snickell

Description

@snickell

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'
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions