Skip to content

Error handlers for rv-reveal-view loading errors #9

@pmoleri

Description

@pmoleri

When using <rv-reveal-view>, if the dashboard doesn't exist or the request fails for any other reason there's no error handler. The unhandled error ends up in the console and the dashboard appears in "New" state.

e.g.
https://codepen.io/pmoleri/pen/EaVOKLo

I'd like to be able to "handle the Error".

It could a callback like in React:
optional onError? callback.

Or perhaps more web components oriented event dispatch:

  try {
    // Code that might throw
  } catch (error) {
    const customEvent = new CustomEvent('componentError', {
      bubbles: true,
      composed: true,
      cancelable: true,
      detail: { originalError: error }
    });
  
    const unhandled = this.dispatchEvent(customEvent);
  
    if (unhandled) {
      console.error('Unhandled error in custom component:', error);
    }
  }

which can be handled by event.preventDefault();.

Workaround:

Load the dashboard myself and pass it to the rv-reveal-view:

        $.ig.RevealUtility.loadDashboard(name)
            .then(dashboard => {
                this.rvRevealView.dashboard = dashboard;
            })
            .catch(err => {
                this.showError(err);
            });

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