Skip to content
Snippets Groups Projects
Commit f866591d authored by Lukas's avatar Lukas
Browse files

Update other contexts error messages

parent 4cbd6a63
Branches
Tags
1 merge request!494Lbudginas/#392 part1 reduce searches component
...@@ -19,7 +19,7 @@ export const useAddressesContext = () => { ...@@ -19,7 +19,7 @@ export const useAddressesContext = () => {
const context = useContext(AddressesContext); const context = useContext(AddressesContext);
if (context === undefined) { if (context === undefined) {
throw new Error("hook must be used inside it`s context"); throw new Error("useAddressesContext must be used inside it`s context");
} }
return context; return context;
......
...@@ -20,7 +20,7 @@ export const HeadBlockContext = createContext<IHeadBlockContext | undefined>( ...@@ -20,7 +20,7 @@ export const HeadBlockContext = createContext<IHeadBlockContext | undefined>(
export const useHeadBlockNumber = () => { export const useHeadBlockNumber = () => {
const context = useContext(HeadBlockContext); const context = useContext(HeadBlockContext);
if (context === undefined) { if (context === undefined) {
throw new Error("hook must be used inside it`s context"); throw new Error("useHeadBlockNumber must be used inside it`s context");
} }
return context; return context;
......
...@@ -14,7 +14,7 @@ export const useHiveChainContext = () => { ...@@ -14,7 +14,7 @@ export const useHiveChainContext = () => {
const context = useContext(HiveChainContext); const context = useContext(HiveChainContext);
if (context === undefined) { if (context === undefined) {
throw new Error("hook must be used inside it`s context"); throw new Error("useHiveChainContext must be used inside it`s context");
} }
return context; return context;
......
...@@ -11,7 +11,17 @@ export const OperationTypesContext = createContext<OperationTypesContextType>({ ...@@ -11,7 +11,17 @@ export const OperationTypesContext = createContext<OperationTypesContextType>({
operationsTypes: undefined, operationsTypes: undefined,
}); });
export const useOperationTypesContext = () => useContext(OperationTypesContext); export const useOperationTypesContext = () => {
const context = useContext(OperationTypesContext);
if (context === undefined) {
throw new Error(
"useOperationTypesContext must be used inside it`s context"
);
}
return context;
};
export const OperationTypesContextProvider: React.FC<{ export const OperationTypesContextProvider: React.FC<{
children: React.ReactNode; children: React.ReactNode;
......
...@@ -20,7 +20,7 @@ export const useUserSettingsContext = () => { ...@@ -20,7 +20,7 @@ export const useUserSettingsContext = () => {
const context = useContext(UserSettingsContext); const context = useContext(UserSettingsContext);
if (context === undefined) { if (context === undefined) {
throw new Error("hook must be used inside it`s context"); throw new Error("useUserSettingsContext must be used inside it`s context");
} }
return context; return context;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment