sindresorhus / electron-better-ipc

Simplified IPC communication for Electron apps
MIT License
715 stars 60 forks source link

Improve error messages #30

Closed ulken closed 4 years ago

ulken commented 4 years ago

Throws more friendly error messages when call(Focused)Renderer() are invoked w/o a BrowserWindow.

Had a hard time adding tests for this, especially for the focused case (probably due to lacking Electron skills – never actually used it). Adding a simple t.throws(Async)() didn't work as BrowserWindow is only defined in the main process. And with more high-level integration tests it was a pain to reproduce a window not being focused. blur-ing the window didn't work (still had focus – even after timeout, awaiting corresponding event etc.).

I ended up hiding the whole window/app. Feel free to remove/edit tests if insufficient or add your own.

Closes #29