Skip to content

implement proper failed error to distinguish between not supported and other kind of failure - #4706

Closed
Murmele wants to merge 2 commits into
rust-windowing:masterfrom
slint-ui:mm/error_type
Closed

Murmele wants to merge 2 commits into
rust-windowing:masterfrom
slint-ui:mm/error_type

Conversation

@Murmele

@Murmele Murmele commented Sep 22, 2026

Copy link
Copy Markdown
Contributor
  • Tested on all platforms changed
  • Added an entry to the changelog module if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality

@dhardy

dhardy commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Distinguishing Failed and NotSupported is potentially confusing. I suggest instead this:

#[non_exhaustive]
pub enum NotSupportedError {
    Transparency,
    PopupWindow,
    // ...
    // If required (but preferably not), a generic option:
    Other(NotSupportedReason),
}

A possible variant of the above would be to add a "reason" payload to each variant:

pub struct ErrorDescription;

#[non_exhaustive]
pub enum NotSupportedError {
    Transparency(ErrorDescription),
    PopupWindow(ErrorDescription),
    // ...
    // If required (but preferably not), a generic option:
    Other(ErrorDescription),
}

Motivation: (a) named variants make it is clear (from a documentation perspective) what the cause of the error was (e.g. Transparency is not supported) and (b) user code can more easily (and less confusingly) react to such errors (e.g. "we must disable transparency" or "we must emulate pop-up windows").

@Murmele

Murmele commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for your PR. I will close this in favour of your one: #4707

@Murmele Murmele closed this Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants