File tree 6 files changed +30
-6
lines changed
6 files changed +30
-6
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,11 @@ export const ManifestContext = createContext<Manifest>(null!);
6
6
export function useManifest ( ) : Manifest {
7
7
const value = useContext ( ManifestContext ) ;
8
8
if ( value == null ) {
9
- throw new Error ( ) ;
9
+ throw new Error (
10
+ process . env . NODE_ENV !== "production"
11
+ ? "ManifestContext is missing"
12
+ : undefined ,
13
+ ) ;
10
14
}
11
15
return value ;
12
16
}
Original file line number Diff line number Diff line change @@ -9,7 +9,11 @@ export const KeyboardContext = createContext<Keyboard>(null!);
9
9
export function useKeyboard ( ) : Keyboard {
10
10
const value = useContext ( KeyboardContext ) ;
11
11
if ( value == null ) {
12
- throw new Error ( ) ;
12
+ throw new Error (
13
+ process . env . NODE_ENV !== "production"
14
+ ? "KeyboardContext is missing"
15
+ : undefined ,
16
+ ) ;
13
17
}
14
18
return value ;
15
19
}
Original file line number Diff line number Diff line change @@ -27,7 +27,11 @@ export const PageDataContext = createContext<PageData>(null!);
27
27
export function usePageData ( ) : PageData {
28
28
const value = useContext ( PageDataContext ) ;
29
29
if ( value == null ) {
30
- throw new Error ( ) ;
30
+ throw new Error (
31
+ process . env . NODE_ENV !== "production"
32
+ ? "PageDataContext is missing"
33
+ : undefined ,
34
+ ) ;
31
35
}
32
36
return value ;
33
37
}
Original file line number Diff line number Diff line change @@ -6,7 +6,11 @@ export const PhoneticModelContext = createContext<PhoneticModel>(null!);
6
6
export function usePhoneticModel ( ) : PhoneticModel {
7
7
const value = useContext ( PhoneticModelContext ) ;
8
8
if ( value == null ) {
9
- throw new Error ( ) ;
9
+ throw new Error (
10
+ process . env . NODE_ENV !== "production"
11
+ ? "PhoneticModelContext is missing"
12
+ : undefined ,
13
+ ) ;
10
14
}
11
15
return value ;
12
16
}
Original file line number Diff line number Diff line change @@ -12,7 +12,11 @@ export const ResultContext = createContext<ResultContextProps>(null!);
12
12
export function useResults ( ) : ResultContextProps {
13
13
const value = useContext ( ResultContext ) ;
14
14
if ( value == null ) {
15
- throw new Error ( ) ;
15
+ throw new Error (
16
+ process . env . NODE_ENV !== "production"
17
+ ? "ResultContext is missing"
18
+ : undefined ,
19
+ ) ;
16
20
}
17
21
return value ;
18
22
}
Original file line number Diff line number Diff line change @@ -11,7 +11,11 @@ export const SettingsContext = createContext<SettingsContextProps>(null!);
11
11
export function useSettings ( ) : SettingsContextProps {
12
12
const value = useContext ( SettingsContext ) ;
13
13
if ( value == null ) {
14
- throw new Error ( ) ;
14
+ throw new Error (
15
+ process . env . NODE_ENV !== "production"
16
+ ? "SettingsContext is missing"
17
+ : undefined ,
18
+ ) ;
15
19
}
16
20
return value ;
17
21
}
You can’t perform that action at this time.
0 commit comments