Reporter version of Safely Try

I am trying to implement a median smoothing filter, which to implement, you must take the median of all neighboring pixels. The problem is that when you try to take the median of neighbors of the first pixel, you get an error because accessing the pixel to the left is accessing an item that does not exist. I tried to remake the safely try block from the catch errors in a script library, but to no avail. Anyone have any ideas? Thanks!

I've done this before
image

Thank you! This should be in the library in 5.4, whenever Jens gets out from under the paperwork SAP is making him do right now.

What is the current version?

5.3.8. To find out next time, click on the Snap! logo at the top left corner (of Snap!, not of the forum) and choose "About."

Thank you.