Skip to content

Commit 5bd8adc

Browse files
author
Patrick Jackson
committed
adjust thread enforment exception message
1 parent c7f534e commit 5bd8adc

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

CHANGELOG.md

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
## [0.3.0] - 2019-12-16
44

5-
### Changed
6-
- update Kotlin to 1.3.60
7-
85
### Added
96
- thread enforcement
107

lib/src/commonMain/kotlin/org/reduxkotlin/CreateStore.kt

+5-4
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ fun <State> createStore(
4848
val storeThreadName = getThreadName()
4949
fun isSameThread() = getThreadName() == storeThreadName
5050
fun checkSameThread() = check(isSameThread()) {
51-
"""You may not call store.getState() from another thread than the store
52-
|was created on. This store was created on: '$storeThreadName' and current
53-
|thread is '${getThreadName()}'
51+
"""You may not call the store from a thread other than the thread on which it was created.
52+
|This includes: getState(), dispatch(), subscribe(), and replaceReducer()
53+
|This store was created on: '$storeThreadName' and current
54+
|thread is '${getThreadName()}'
5455
""".trimMargin()
5556
}
5657

@@ -230,7 +231,7 @@ fun <State> createStore(
230231
// the initial state tree.
231232
dispatch(ActionTypes.INIT)
232233

233-
return object: Store<State> {
234+
return object : Store<State> {
234235
override val getState = ::getState
235236
override var dispatch: Dispatcher = ::dispatch
236237
override val subscribe = ::subscribe

0 commit comments

Comments
 (0)