Add a helpful warning on auto-discarded scrubs
This commit is contained in:
parent
158923b376
commit
13d612f4b7
1 changed files with 6 additions and 4 deletions
|
@ -4,7 +4,6 @@ import type {Pointer} from '@theatre/dataverse'
|
|||
import {getPointerParts} from '@theatre/dataverse'
|
||||
import type {Studio} from './Studio'
|
||||
import type {CommitOrDiscard} from './StudioStore/StudioStore'
|
||||
import logger from '@theatre/shared/logger'
|
||||
import {isSheetObject} from '@theatre/shared/instanceTypes'
|
||||
|
||||
type State_Captured = {
|
||||
|
@ -129,7 +128,7 @@ export default class Scrub implements IScrub {
|
|||
state.flagsTransaction.discard()
|
||||
this._state = {type: 'Committed'}
|
||||
} else if (state.type === 'Ready') {
|
||||
logger.warn(`Scrub is empty. Nothing to commit.`)
|
||||
console.warn(`Scrub is empty. Nothing to commit.`)
|
||||
return
|
||||
} else if (state.type === 'Committed') {
|
||||
throw new Error(`This scrub is already committed.`)
|
||||
|
@ -150,6 +149,9 @@ export default class Scrub implements IScrub {
|
|||
errored = false
|
||||
} finally {
|
||||
if (errored) {
|
||||
console.error(
|
||||
`This scrub's callback threw an error. We're undo-ing all of the changes made by this scrub, and marking it as discarded.`,
|
||||
)
|
||||
this._state = {type: 'Discarded'}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue