Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Avoid undefined is not a function error in onWorkerError #1073

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 34 additions & 12 deletions src/screens/konnectors/LauncherView.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,17 +349,31 @@ export class LauncherView extends Component {
* @param {Object} event
*/
onWorkerError({ nativeEvent }) {
log.error('onWorkerError', { nativeEvent })
this.stop({ message: 'VENDOR_DOWN' })
if (this.launcher) {
this.launcher.log({
level: 'error',
msg: 'Worker webview error: ' + JSON.stringify(nativeEvent)
})
this.launcher.stop({ message: 'VENDOR_DOWN' })
} else {
log.error('onWorkerError', JSON.stringify(nativeEvent))
}
}
/**
* When an error is detected in the pilot webview
*
* @param {Object} event
*/
onPilotError({ nativeEvent }) {
log.error('onPilotError', { nativeEvent })
this.stop({ message: 'VENDOR_DOWN' })
if (this.launcher) {
this.launcher.log({
level: 'error',
msg: 'Pilot webview error: ' + JSON.stringify(nativeEvent)
})
this.launcher.stop({ message: 'VENDOR_DOWN' })
} else {
log.error('onPilotError', JSON.stringify(nativeEvent))
}
}
/**
* Postmessage relay from the pilot to the launcher
Expand All @@ -379,10 +393,14 @@ export class LauncherView extends Component {
*/
onPilotWebviewKilled(syntheticEvent) {
const { nativeEvent } = syntheticEvent
this.launcher.log({
level: 'error',
msg: 'Pilot webview terminated: ' + JSON.stringify(nativeEvent)
})
if (this.launcher) {
this.launcher.log({
level: 'error',
msg: 'Pilot webview terminated: ' + JSON.stringify(nativeEvent)
})
} else {
log.error('onPilotWebviewKilled', JSON.stringify(nativeEvent))
}
}
/**
* When the worker webview is killed
Expand All @@ -391,10 +409,14 @@ export class LauncherView extends Component {
*/
onWorkerWebviewKilled(syntheticEvent) {
const { nativeEvent } = syntheticEvent
this.launcher.log({
level: 'error',
msg: 'Worker webview terminated: ' + JSON.stringify(nativeEvent)
})
if (this.launcher) {
this.launcher.log({
level: 'error',
msg: 'Worker webview terminated: ' + JSON.stringify(nativeEvent)
})
} else {
log.error('onWorkerWebviewKilled', JSON.stringify(nativeEvent))
}
}
/**
* Postmessage relay from the worker to the launcher
Expand Down
Loading