Skip to content

Commit

Permalink
fix: return an exception instead of null when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed Jun 22, 2020
1 parent 2766e23 commit 2fb775a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,10 @@ const handleRemoteCommand = function (channel: string, handler: (event: IpcMainE
ipcMain.on(channel, (event, contextId: string, ...args: any[]) => {
let returnValue: MetaType | null | void
if (!isRemoteModuleEnabled(event.sender)) {
event.returnValue = null
event.returnValue = {
type: 'exception',
value: valueToMeta(event.sender, contextId, new Error('@electron/remote is disabled for this WebContents. Set {enableRemoteModule: true} in WebPreferences to enable it.'))
}
return
}

Expand Down

0 comments on commit 2fb775a

Please sign in to comment.