@olea-bps/context-event 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +5 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -133,7 +133,11 @@ export default function EventContextProvider({ children }) {
133
133
  * @returns {object} Eventkontext
134
134
  */
135
135
  export function useEventContext() {
136
- return useContext(EventContext);
136
+ const context = useContext(EventContext);
137
+ if (context === null) {
138
+ throw new Error('useEventContext must be used within an EventContextProvider');
139
+ }
140
+ return context;
137
141
  }
138
142
 
139
143
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olea-bps/context-event",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Context for event",
5
5
  "main": "index.js",
6
6
  "type": "module",