How to use the inferno-shared.throwError function in inferno-shared

To help you get started, we’ve selected a few inferno-shared 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 infernojs / inferno / packages / inferno-server / src / renderToString.queuestream.ts View on Github external
this.addToQueue(renderedString + '', position);
        }
      }
      // Push text directly to queue
    } else if ((flags & VNodeFlags.Text) > 0) {
      this.addToQueue(children === '' ? ' ' : escapeText(children), position);
      // Handle errors
    } else {
      if (process.env.NODE_ENV !== 'production') {
        if (typeof vNode === 'object') {
          throwError(`renderToString() received an object that's not a valid VNode, you should stringify it first. Object: "${JSON.stringify(vNode)}".`);
        } else {
          throwError(`renderToString() expects a valid VNode, instead it received an object with the type "${typeof vNode}".`);
        }
      }
      throwError();
    }
  }
}
github infernojs / inferno / packages / inferno-hydrate / src / index.ts View on Github external
}
  if (flags & VNodeFlags.Element) {
    return hydrateElement(vNode, parentDOM, currentDom, context, isSVG, lifecycle);
  }
  if (flags & VNodeFlags.Text) {
    return hydrateText(vNode, parentDOM, currentDom);
  }
  if (flags & VNodeFlags.Void) {
    return (vNode.dom = currentDom);
  }
  if (flags & VNodeFlags.Fragment) {
    return hydrateFragment(vNode, parentDOM, currentDom, context, isSVG, lifecycle);
  }

  if (process.env.NODE_ENV !== 'production') {
    throwError(`hydrate() expects a valid VNode, instead it received an object with the type "${typeof vNode}".`);
  }
  throwError();

  return null;
}
github infernojs / inferno / packages / inferno-hydrate / src / index.ts View on Github external
return hydrateElement(vNode, parentDOM, currentDom, context, isSVG, lifecycle);
  }
  if (flags & VNodeFlags.Text) {
    return hydrateText(vNode, parentDOM, currentDom);
  }
  if (flags & VNodeFlags.Void) {
    return (vNode.dom = currentDom);
  }
  if (flags & VNodeFlags.Fragment) {
    return hydrateFragment(vNode, parentDOM, currentDom, context, isSVG, lifecycle);
  }

  if (process.env.NODE_ENV !== 'production') {
    throwError(`hydrate() expects a valid VNode, instead it received an object with the type "${typeof vNode}".`);
  }
  throwError();

  return null;
}
github infernojs / inferno / packages / inferno-server / src / renderToString.ts View on Github external
if (childFlags === ChildFlags.HasVNodeChildren) {
      return '';
    } else if (childFlags & ChildFlags.MultipleChildren) {
      let renderedString = '';

      for (let i = 0, len = children.length; i < len; ++i) {
        renderedString += renderVNodeToString(children[i], vNode, context);
      }

      return renderedString;
    }
  } else {
    if (process.env.NODE_ENV !== 'production') {
      if (typeof vNode === 'object') {
        throwError(`renderToString() received an object that's not a valid VNode, you should stringify it first. Object: "${JSON.stringify(vNode)}".`);
      } else {
        throwError(`renderToString() expects a valid VNode, instead it received an object with the type "${typeof vNode}".`);
      }
    }
    throwError();
  }

  return '';
}