@@ -66,7 +66,7 @@ export function spawnWith(deps) {
6666 if ( ! scheduler ) throw new Error ( 'No scheduler provided' )
6767 if ( ! module ) throw new Error ( 'No module provided' )
6868
69- const authority = process . env . AUTHORITY || scheduler
69+ const authority = process . env . AUTHORITY || args . authority || scheduler
7070
7171 debugLog ( 'info' , 'Node URL:' , deps . url )
7272 debugLog ( 'info' , 'Scheduler:' , scheduler )
@@ -93,21 +93,15 @@ export function spawnWith(deps) {
9393
9494 try {
9595 const processId = response . headers . get ( 'process' )
96-
9796 debugLog ( 'info' , 'Process ID:' , processId )
9897
99- if ( processId ) {
100- await retryInitPush ( deps , processId , 10 )
101-
102- return processId
103- }
104-
105- return null ;
98+ if ( processId ) return processId ;
99+ else throw new Error ( 'Error spawning process' )
106100 } catch ( e ) {
107- throw new Error ( e . message ?? 'Error spawning mainnet process' )
101+ throw new Error ( e . message ?? 'Error spawning process' )
108102 }
109103 } catch ( e ) {
110- throw new Error ( e . message ?? 'Error spawning mainnet process' )
104+ throw new Error ( e . message ?? 'Error spawning process' )
111105 }
112106 }
113107}
@@ -131,9 +125,9 @@ export function messageWith(deps) {
131125 if ( args . opts ?. fullResponse ) return convertToLegacyOutput ( parsedResponse )
132126 else return parsedResponse . slot
133127 }
134- return null
128+ else throw new Error ( 'Error sending message' )
135129 } catch ( e ) {
136- throw new Error ( e . message ?? 'Error sending mainnet message' )
130+ throw new Error ( e . message ?? 'Error sending message' )
137131 }
138132 }
139133}
@@ -153,9 +147,9 @@ export function resultWith(deps) {
153147 const parsedResponse = await response . json ( )
154148 return convertToLegacyOutput ( parsedResponse )
155149 }
156- return null
150+ else throw new Error ( 'Error getting result' )
157151 } catch ( e ) {
158- throw new Error ( e . message ?? 'Error sending mainnet message ' )
152+ throw new Error ( e . message ?? 'Error getting result ' )
159153 }
160154 }
161155}
@@ -195,14 +189,14 @@ export function resultsWith(deps) {
195189 }
196190 }
197191
198- return null
192+ else throw new Error ( 'Error getting results' )
199193 } catch ( e ) {
200194 throw new Error ( e . message ?? 'Error getting current process slot' )
201195 }
202196 }
203- return null
197+ else throw new Error ( 'Error getting results' )
204198 } catch ( e ) {
205- throw new Error ( e . message ?? 'Error sending mainnet message ' )
199+ throw new Error ( e . message ?? 'Error getting results ' )
206200 }
207201 }
208202}
@@ -228,14 +222,14 @@ export function dryrunWith(deps) {
228222 const parsedResponse = await response . json ( )
229223 return convertToLegacyOutput ( parsedResponse )
230224 }
231- return null
225+ else throw new Error ( 'Error running dryrun' )
232226 } catch ( e ) {
233- throw new Error ( e . message ?? 'Error sending mainnet message ' )
227+ throw new Error ( e . message ?? 'Error running dryrun ' )
234228 }
235229 }
236230}
237231
238- async function retryInitPush ( deps , processId , maxAttempts = 10 ) {
232+ async function _retryInitPush ( deps , processId , maxAttempts = 10 ) {
239233 const params = {
240234 path : `/${ processId } /push` ,
241235 target : processId ,
0 commit comments