File tree Expand file tree Collapse file tree
packages/lib/src/usecases Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,15 +143,22 @@ export const readProjectRuntimeState = (
143143 const fs = yield * _ ( FileSystem . FileSystem )
144144 const path = yield * _ ( Path . Path )
145145 const statePath = resolveProjectRuntimeStatePath ( path , projectDir )
146- const exists = yield * _ ( fs . exists ( statePath ) )
147- if ( ! exists ) {
146+ const exists = yield * _ ( Effect . either ( fs . exists ( statePath ) ) )
147+ const fileExists = Either . match ( exists , {
148+ onLeft : ( ) => false ,
149+ onRight : ( value ) => value
150+ } )
151+ if ( ! fileExists ) {
148152 return emptyProjectRuntimeState ( )
149153 }
150154
151- const contents = yield * _ ( fs . readFileString ( statePath ) )
152- const decoded = decodeProjectRuntimeStateFile ( contents )
155+ const contents = yield * _ ( Effect . either ( fs . readFileString ( statePath ) ) )
156+ const decoded = Either . match ( contents , {
157+ onLeft : ( ) => null ,
158+ onRight : decodeProjectRuntimeStateFile
159+ } )
153160 return decoded === null ? emptyProjectRuntimeState ( ) : toRuntimeState ( decoded )
154- } ) . pipe ( Effect . catchAll ( ( ) => Effect . succeed ( emptyProjectRuntimeState ( ) ) ) )
161+ } )
155162
156163// CHANGE: persist successful runtime launches into project-local `.orch/state`
157164// WHY: DB-only project listing can still sort by latest launch time
You can’t perform that action at this time.
0 commit comments