European Parliament MCP Server API - v1.0.1
    Preparing search index...

    Function isMCPServerError

    • Type guard for MCPServerError

      Checks if an unknown error is an instance of MCPServerError or one of its subclasses. Useful for error handling and formatting.

      Parameters

      • error: unknown

        Unknown error to check

      Returns error is MCPServerError

      true if error is an MCPServerError or subclass

      try {
      await fetchMEPs();
      } catch (error) {
      if (isMCPServerError(error)) {
      console.error(`Error ${error.code}: ${error.message}`);
      }
      }