0.0.23 • Published 1 month ago

@ray-js/ray-error-catch v0.0.23

Weekly downloads
-
License
MIT
Repository
-
Last release
1 month ago

English | 简体中文

@ray-js/ray-error-catch

latest download

Exception Handling Component

    1. When there is an exception in the mini-program, it will be captured and a generic fallback page will be displayed, guiding the user to upload logs to help developers locate the problem.
    1. Provide interfaces for mini-program developers to customize and add logs.
    1. Note ⚠️:
    • Mini-program basic library version requirement:
      • Greater than or equal to 2.13.0.
    • Capture scope:
      • Only exceptions in synchronously executed JavaScript code can be automatically captured.
      • Asynchronous code such as setTimeout and setInterval, AJAX requests, Web Workers, client-side storage, and other asynchronous execution code cannot trigger automatic error catching.

Installation

$ npm install @ray-js/ray-error-catch
# or
$ yarn add @ray-js/ray-error-catch

Usage

import RayErrorCatch from '@ray-js/ray-error-catch';

// Basic usage
const Home = () => {
  return (
    <RayErrorCatch>
      {/* 业务根组件 */}
      <RootELement />
    </RayErrorCatch>
  );
};

// Advanced usage: Allow developers to customize copywriting based on business conditions
const Home = () => {
  return (
    <RayErrorCatch
      errorTitle="自定义异常标题"
      errorText="自定义异常文案"
      submitText="自定义提交文案"
    >
      {/* 业务根组件 */}
      <RootELement />
    </RayErrorCatch>
  );
};
// Advanced usage: allows developers to customize the display of exception pages based on business conditions.
const Home = () => {
  const [forceShow, setForceShow] = useState(false);

  return (
    <RayErrorCatch
      forceShow={forceShow}
      errorTitle="自定义异常标题"
      errorText="自定义异常文案"
      submitText="自定义提交文案"
    >
      {/* 业务根组件 */}
      <RootELement />
    </RayErrorCatch>
  );
};
0.0.23

1 month ago

0.0.23-beta-1

1 month ago

0.0.22

5 months ago

0.0.22-beta-1

5 months ago

0.0.21-beta-1

8 months ago

0.0.20

8 months ago

0.0.20-beta-1

8 months ago

0.0.19

8 months ago

0.0.19-beta-1

8 months ago

0.0.17-beta-1

8 months ago

0.0.15-beta-1

8 months ago

0.0.14-beta-1

8 months ago

0.0.13-beta-1

8 months ago

0.0.12-beta-1

8 months ago

0.0.11

8 months ago

0.0.11-beta-1

8 months ago

0.0.10-beta-1

8 months ago

0.0.9-beta-1

8 months ago

0.0.8

9 months ago

0.0.8-beta-1

9 months ago

0.0.7-beta-1

9 months ago

0.0.6-beta-1

9 months ago

0.0.5-beta-2

9 months ago

0.0.5-beta-1

9 months ago

0.0.4-beta-1

9 months ago