Suggestions for logging client-side javascript errors into a local file in AngularJs?

I am responsible for logging production side javascript errors into a local file on the client machine with the help of AngularJs and the Electron framework. The client can press a button that goes into this file and extract all the exceptions with a certain date range.

I've already logged server-side exceptions, but I do not know how to approach this task. My research has shown different ways to use a paid service such as Sentry.io or another library such as StackTrace, but I would like to avoid libraries and external frameworks if possible. Does anyone have a good recommendation on how I should handle exceptions for logging a file in AngularJs?