Skip to content

Warning & Error definitions

Jenna Salau edited this page Aug 19, 2017 · 16 revisions

RHW01

WARNING: RHW01 Cannot resolve component ... for element.

This warning is raised when React Habitat cannot find a registration in your bootstrapper container for the data-component attribute; or the data-component attribute is an empty string.

Registration's are created by either the Container.register or Container.registerAll methods.

  • Check that the value of data-component is not empty for this element.
  • Check that the value of data-component has a matching registration in your container class.
  • Check that the registration name doesn't contain special characters and or spaces.

RHW02

ERROR: RHW02 A container is already set. Please call dispose() before assigning a new one.

This error is thrown when calling setContainer on a bootstrapper class that already has a container. If you want to replace the container you must call 'dispose' on the bootstrapper class first.

  • Check that you are not calling 'setContainer' multiple times.
  • Call dispose() first

RHW03

WARNING: RHW03 ... is being deprecated. Please use ... instead.

This warning is raised when you are using a method that is being phased out and will be completely removed at the next major release. You are advised to check the change log and update to the new methods as soon as possible.

  • Check the change logs in the Readme.md for update instructions.

RHW04

WARNING: RHW04 Cannot open a habitat for element.

This warning is raised when either:

  • The 'data-component' is added to the body tag.
  • React Habitat cannot interoperate the element with the 'data-component' attribute.

You can try:

  • Check the data-component attribute is not on the body tag
  • Check the element is a valid HTML5 tag.

RHW05

WARNING: RHW05 React Habitat element not empty.

UPDATE: In v0.4.0 this warning has been relaxed.

This warning is raised when the data-component attribute is on an element that has children. All React Habitat elements must be empty and any child components instead should be added inside the React component itself.

  • Check that the element does not have any children elements and or text.
  • Update to React Habitat v0.4.0 or greater

RHW06

WARNING: RHW06 Arbitrary properties are disabled. The container may not dispose correctly.

React Habitat keeps reference's to the original nodes by setting an arbitrary property on the habitat element itself. This warning is raised when the browser and or application has 'Expando' turned off and habitat cannot make this reference connection.

In most cases this is completely harmless, however if dispose is ever called React Habitat may not be able to place back the original DOM nodes as they may have been garbage collected. However, if you never plan to call dispose, you can ignore this warning.

Please see https://msdn.microsoft.com/en-us/library/ms533747(v=vs.85).aspx

  • Re-enable Expando

RHW07

WARNING: RHW07 Target element is null or undefined.

This warning is raised when React Habitat cannot render a React component as the target element is null or undefined. If you see this error it is most likely an internal error and you are encouraged to open a new issue.

  • Check the target element exists
  • Likely a bug in React Habitat; Open a new issue.

RHW08

WARNING: RHW08 Component should not contain any nested components.

This warning is raised when a React Habitat component contains one or more nested React Habitat component children.

For example, the following is an anti pattern and discouraged:

<div data-component="SomeComponent">
    <div data-component="ChildComponent"></div>
</div>
  • Remove the offending child component(s) from your html
  • Move the child component into React itself

RHE09

ERROR: RHE09 MutationObserver not available.

This warning is raised when a React Habitat watcher has been attempted to start on a browser that does not support the underlying MutationObserver feature.

RHE10

ERROR: RHE10 Incompatible factory.

This error is raised when a React Habitat factory is either undefined, not a class or missing the required methods inject and dispose.

  • Is your factory using static methods? If not, you might need to use new
  • Check inject is a method on your factory
  • Check dispose is a method on your factory

RHE11

ERROR: RHE11 Missing key for registration.

This error is raised when a React Habitat registration is missing a key.

  • Set a key using the as() method.

For example

containerBuilder.register(myComponent).as('MyKey');

RHW12

ERROR: RHW12 Duplicate key.

This warning is raised when a React Habitat registration has a key that has already been defined by a previous registration. In this situation, that later registration will take precedence.

  • Keys must be unique.

RHE13

ERROR: RHE13 Unexpected key type. Expected a string.

This error is raised when a React Habitat registration is defined with a undefined or illegal key type. Key's must be a string.

Bad

  • as()
  • as({})
  • as(MyClass)
  • as(33)

Good

  • as('MyComponent')