• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

alkem-io / client-web / #8415

19 Jul 2024 02:05PM UTC coverage: 5.749%. First build
#8415

Pull #6612

travis-ci

Pull Request #6612: Package updates to reduce vulnerabilities

188 of 9965 branches covered (1.89%)

Branch coverage included in aggregate %.

0 of 13 new or added lines in 7 files covered. (0.0%)

1407 of 17778 relevant lines covered (7.91%)

0.19 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

10.0
/src/domain/shared/utils/useLoadingStateWithHandlers.ts
1
import useLoadingState, { Callback, Provided } from './useLoadingState';
2
import { useCallback } from 'react';
3

4
interface Handlers {
5
  onError?: (error: Error) => void;
6
}
7

8
const useLoadingStateWithHandlers = <Args extends unknown[], Result>(
1✔
9
  originalCallback: Callback<Args, Result>,
10
  { onError }: Handlers
11
): Provided<Args, Result | undefined> => {
12
  const [callback, ...rest] = useLoadingState(originalCallback);
×
13

14
  const callbackWithHandlers = useCallback(
×
15
    async (...args: Args) => {
16
      try {
×
17
        return await callback(...args);
×
18
      } catch (error) {
NEW
19
        if (error instanceof Error) {
×
NEW
20
          onError?.(error);
×
21
        }
22
      }
23
    },
24
    [callback, onError]
25
  );
26

27
  return [callbackWithHandlers, ...rest];
×
28
};
29

30
export default useLoadingStateWithHandlers;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc