Skip to content

Commit c51e477

Browse files
committed
Allow for temporary connection failures
1 parent 270a02e commit c51e477

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

src/plugin.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,17 @@ export default class ArtimiPlugin {
8585
}
8686
}
8787

88-
switch (next.state) {
89-
case 'completed':
90-
return next
91-
case 'created':
92-
case 'active':
93-
case 'suspended':
94-
break
95-
default:
96-
throw new Error(`transcription request state "${next.state}"`)
88+
if (next) {
89+
switch (next.state) {
90+
case 'completed':
91+
return next
92+
case 'created':
93+
case 'active':
94+
case 'suspended':
95+
break
96+
default:
97+
throw new Error(`transcription request state "${next.state}"`)
98+
}
9799
}
98100

99101
await this.wait(interval)

0 commit comments

Comments
 (0)