<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Malte Granderath on Medium]]></title>
        <description><![CDATA[Stories by Malte Granderath on Medium]]></description>
        <link>https://medium.com/@malte.granderath?source=rss-3cd71efc474b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*UbFHVlF78t5UoiXAUD7zSg.png</url>
            <title>Stories by Malte Granderath on Medium</title>
            <link>https://medium.com/@malte.granderath?source=rss-3cd71efc474b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 05:16:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@malte.granderath/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using Sentry in a Browser Extension]]></title>
            <link>https://medium.com/@malte.granderath/using-sentry-in-a-browser-extension-f7ae99c896ec?source=rss-3cd71efc474b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7ae99c896ec</guid>
            <category><![CDATA[browser-extension]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[sentry]]></category>
            <dc:creator><![CDATA[Malte Granderath]]></dc:creator>
            <pubDate>Wed, 06 Feb 2019 23:53:21 GMT</pubDate>
            <atom:updated>2019-02-06T23:53:21.129Z</atom:updated>
            <content:encoded><![CDATA[<p>You would think that utilizing Sentry to track errors in a Browser extension is easy but it is actually not. This is how I solved it.</p><h3>Installing Sentry</h3><p>To use sentry in the browser extension first install the package using yarn or npm</p><pre># npm <br>install @sentry/browser <br>#yarn <br>yarn add @sentry/browser</pre><h3>Using Sentry</h3><p>To utilize sentry you have to follow the usual setup they give you on their website</p><pre>import * as sentry from &quot;@sentry/browser&quot;; </pre><pre>Sentry.init({ dsn: &quot;YOUR_DSN&quot; }) </pre><pre>function example() { <br>  throw new Error(&quot;Example Error&quot;) <br>} </pre><pre>example()</pre><p>Now you might think that you will be tracking errors but unfortunately, this will not work out of the box. You first have to make some changes to the above code:</p><ol><li>wrap the whole execution in a try-catch</li><li>add an eventlistener for the “unhandledrejection” event</li></ol><p>The code will then look like this:</p><pre>import * as sentry from &quot;@sentry/browser&quot;; </pre><pre>Sentry.init({ dsn: &quot;YOUR_DSN&quot; }) </pre><pre>window.addEventListener(&#39;unhandledrejection&#39;, event =&gt; {<br>  Sentry.captureEvent(event.reason) <br>});<br> <br>function example() { <br>  throw new Error(&quot;Example Error&quot;) <br>} </pre><pre>try { <br>  example() <br>} catch (e) { <br>  Sentry.captureEvent(e) <br>}</pre><p><strong>Success</strong>! Now sentry will capture the error/exception but you will quickly notice something that doesn’t look alright.</p><h3>Fixing the Problem</h3><p>If you upload sourcemaps to sentry you would expect that they would be used to simplify finding the error but unfortunately, by default, sentry reports the error in the .js file with the full path on the users system. You might see a error description with a path like this:</p><pre>.../Default/Extensions/&lt;extension-id&gt;/0.0.1.10_0/content_script.js</pre><p>instead of just the truncated relative path.</p><p>We have to truncate the path manually before sending the event to make sure that sentry recognizes the files for the sourcemaps. We do this by specifying a beforeSend function in the Sentry.init call.</p><pre>Sentry.init({<br> dsn: &#39;YOUR_DSN&#39;, <br> beforeSend(event, hint) { <br>   if (event.exception) {<br>     event.exception.values[0].stacktrace.<br>       frames.forEach((frame) =&gt; { <br>         frame.filename = frame.filename.substring(frame.filename.lastIndexOf(&quot;/&quot;)) <br>       }); <br>   } <br>   return event; <br>  } <br>});</pre><p>This will properly report errors and the correct sourcemaps will be used by sentry.</p><p>What I use this for?</p><p>I am currently working on StreamParty, “a browser extension, that allows you to watch video streams in sync with your significant other all across the world, on multiple platforms.” Check it out! <a href="https://www.streamparty.tv/">https://www.streamparty.tv/</a></p><p><em>Originally published at </em><a href="https://www.granderath.tech/sentry-browser-extension/"><em>www.granderath.tech</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7ae99c896ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Amplitude in a Chrome Extension]]></title>
            <link>https://medium.com/@malte.granderath/using-amplitude-in-a-chrome-extension-4dfbb0f19c93?source=rss-3cd71efc474b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4dfbb0f19c93</guid>
            <category><![CDATA[amplitudejs]]></category>
            <category><![CDATA[chrome-extension]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[amplitude]]></category>
            <dc:creator><![CDATA[Malte Granderath]]></dc:creator>
            <pubDate>Sun, 27 Jan 2019 11:36:38 GMT</pubDate>
            <atom:updated>2019-01-27T11:36:38.926Z</atom:updated>
            <content:encoded><![CDATA[<p>For one of my projects, I utilized Amplitude for Event tracking and this is how I did it.</p><h3>Why Amplitude?</h3><p>In my last internship, I had already used it for event tracking and I was used to it. I also wanted pure event tracking analytics and nothing similar to Google Analytics.</p><h3>Setting up</h3><p>First, you have to install the amplitude-js module:</p><pre># npm<br>npm install amplitude-js<br># yarn <br>yarn add amplitude-js</pre><h3>Using Amplitude</h3><p>Now that we have the library installed we can utilize it in popup.js , etc.</p><pre>import amplitude from &quot;amplitude-js/amplitude&quot;;</pre><pre>amplitude.getInstance().init(&quot;API_KEY&quot;); amplitude.getInstance().logEvent(&quot;ExampleEvent&quot;, { exampleProperty: &quot;test&quot; });</pre><p><em>Originally published at </em><a href="https://www.granderath.tech/amplitude-chrome-extension/"><em>www.granderath.tech</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4dfbb0f19c93" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android: Converting a List to DataSource.Factory]]></title>
            <link>https://medium.com/@malte.granderath/android-converting-a-list-to-datasource-factory-3d677b2cd8cc?source=rss-3cd71efc474b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d677b2cd8cc</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Malte Granderath]]></dc:creator>
            <pubDate>Sun, 22 Jul 2018 19:03:04 GMT</pubDate>
            <atom:updated>2018-07-23T07:44:56.774Z</atom:updated>
            <content:encoded><![CDATA[<p>For one of my projects I was looking to test the Google Paging library for android. However, I was only looking to test the View and ViewModel, but for now the Paging library only works with a DataSource.Factory, which can either be created by Room or you can implement your own one.</p><p>If you need to convert a List to a DataSource.Factory the below snippet will help you</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea9bf3b64641fd8dbd2b880879158240/href">https://medium.com/media/ea9bf3b64641fd8dbd2b880879158240/href</a></iframe><p>If you are looking into seeing this in action, this is a small project that uses it:</p><p><a href="https://github.com/magrandera/GooglePagingwithList">magrandera/GooglePagingwithList</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d677b2cd8cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>