Skip to content

Enum: MessageBox.Icon.NONE being undefined causes Error #4273

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

Closed
boghyon opened this issue Apr 29, 2025 · 5 comments
Closed

Enum: MessageBox.Icon.NONE being undefined causes Error #4273

boghyon opened this issue Apr 29, 2025 · 5 comments
Assignees

Comments

@boghyon
Copy link
Contributor

boghyon commented Apr 29, 2025

This is a sub-issue of #4201. Due to the MessageBox.Icon.NONE being undefined, which is not allowed according to the documented guideline shown in the parent issue, calling sap/ui/base/DataType.getType("sap.m.MessageBox.Icon") currently causes:

Uncaught (in promise) Error: Value undefined for enum type sap.m.MessageBox.Icon is not a string

/**
* Enumeration of the pre-defined icons that can be used in a MessageBox.
* @enum {string}
* @public
*/
MessageBox.Icon = {
/**
* Shows no icon in the message box.
* @public
*/
NONE: undefined,

@i556484
Copy link
Member

i556484 commented Apr 29, 2025

Hello @boghyon ,
Thank you for sharing this finding. I've created an internal incident DINC0487664. The status of the issue will be updated here in GitHub.

@dimovpetar
Copy link
Contributor

Hello @boghyon ,

Why would you assume that sap.m.MessageBox.Icon is a DataType?

Best regards,
Petar

@boghyon
Copy link
Contributor Author

boghyon commented May 5, 2025

sap.m.MessageBox.Icon and .Action are both documented as enum types.

While calling DataType.getType("sap.m.MessageBox.Action").isEnumType() returns true expectedly, calling the same with "sap.m.MessageBox.Icon" fails as described above.

If they're not supposed to be real enum in contrast to the documentation, and if those types are not registered via DataType.registerEnum by design, feel free to close this issue.

@dimovpetar
Copy link
Contributor

Hello,

Key-value pairs of MessageBox.Icon enum are now all identical.
However, I am still confused by the relationship between "real enum" and DataType. To my understanding:

  1. Types registered as DataType are intended to be used in ManagedObject and its descendants, whereas MessageBox is not such
  2. Some DataType types might be enums, but not every enum is a DataType

Best regards,
Petar

@codeworrior
Copy link
Member

@dimovpetar I agree to your point of view.

Several UI5 libraries (not OpenUI5) contain enums that are only used in JavaScript APIs, but not in managed settings. I would find it very limiting for the API design, if all those enums would have to stick to the UI5 rules for managed settings.

But I also get @boghyon's point. It is currently difficult to understand why not every enum can be used in managed settings, either because it doesn't follow the conventions (key === value) or because it isn't registered.

Maybe we should at least mention in the documentation whether an enum can be used for a managed setting (in the sense that it is registered as DataType).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants