How to use the @storybook/client-logger.logger.error function in @storybook/client-logger

To help you get started, we’ve selected a few @storybook/client-logger examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github storybookjs / storybook / lib / core / src / client / preview / start.js View on Github external
function showException(exception) {
  addons.getChannel().emit(Events.STORY_THREW_EXCEPTION, exception);
  showErrorDisplay(exception);

  // Log the stack to the console. So, user could check the source code.
  logger.error(exception.stack);
}
github storybookjs / storybook / lib / channel-postmessage / src / index.ts View on Github external
private handleEvent(rawEvent: RawEvent): void {
    try {
      const { data } = rawEvent;
      const { key, event } = typeof data === 'string' && isJSON(data) ? parse(data) : data;
      if (key === KEY) {
        logger.debug(`message arrived at ${this.config.page}`, event.type, ...event.args);
        this.handler(event);
      }
    } catch (error) {
      logger.error(error);
      // debugger;
    }
  }
}
github storybookjs / storybook / lib / ui / src / containers / nav.js View on Github external
const leafId = leafChildren[0];
    const component = { ...rest, id: leafId, isLeaf: true, isComponent: true };
    componentIdToLeafId[id] = leafId;

    if (
      (isComponent && nonLeafChildren.length > 0) ||
      (!isComponent && nonLeafChildren.length === 0)
    ) {
      throw new Error(
        `Unexpected '${item.id}': ${JSON.stringify({ isComponent, nonLeafChildren })}`
      );
    }

    if (nonLeafChildren.length > 0) {
      logger.error(
        `Node ${item.id} contains non-leaf nodes that are getting removed: ${nonLeafChildren}!`
      );
    }

    return component;
  });
github storybookjs / storybook / addons / a11y / src / components / ColorBlindness.tsx View on Github external
setFilter = (filter: string | null) => {
    const iframe = getIframe();

    if (iframe) {
      iframe.style.filter = getFilter(filter);
      this.setState({
        expanded: false,
        filter,
      });
    } else {
      logger.error('Cannot find Storybook iframe');
    }
  };
github storybookjs / storybook / addons / links / src / preview.ts View on Github external
if (kindVal && !storyVal) {
        return i.kind === kindVal;
      }
      if (!kindVal && !storyVal) {
        return i.kind === current.kind;
      }
      return false;
    });

  if (item) {
    navigate({
      kind: item.kind,
      story: item.story,
    });
  } else {
    logger.error('could not navigate to provided story');
  }
};
github storybookjs / storybook / lib / ui / src / settings / persist.ts View on Github external
export const setAll = (itemToSet: string | number, changes: any): void => {
  try {
    const serializedChanges = JSON.stringify(changes);
    localStorage.setItem(itemToSet, serializedChanges);
  } catch (e) {
    logger.error(e);
  }
};
github storybookjs / storybook / lib / client-api / src / story_store.js View on Github external
fromId = id => {
    try {
      const data = this._data[id];

      if (!data || !data.getDecorated) {
        return null;
      }

      return data;
    } catch (e) {
      logger.warn('failed to get story:', this._data);
      logger.error(e);
      return {};
    }
  };