Make Sure the image tag is available with your name(Sample).
<img id="sample" src="" />
then try to access as your code
document.getElementById("sample").src
The Javascript Try block can only find error with in the HTML document, not about the Physical Path of your file(res/defult/arrow.svg).
For exp, above code works as if the image tag is available then sets source of the image tag with "
res/defult/arrow.svg"
other wise it throws the error to Catch Block.