title: How to handle Firebase Storage StorageException
body: <p>My app gets images from Firebase storage. In the event that there exist no image I want to be able to handle the error. But I can't seem to get it working.</p>
  
  <p>I have tried surrounding with try catch.</p>
  
  <p>I have tried this</p>
  
  <pre><code>Future&lt;dynamic&gt; getImage(int index){
        return FirebaseStorage.instance.ref().child(widget.snap[index].data['英文品名']+".jpg").getDownloadURL().catchError((onError){
          print(onError);
        }); 
   }
  </code></pre>
  
  <p>and this</p>
  
  <pre><code> Future&lt;dynamic&gt; getImage(int index){
     var imageStream;
     try {
         imageStream = FirebaseStorage.instance.ref().child(widget.snap[index].data['英文品名']+".jpg").getDownloadURL();    
     } catch (e) {
       print(e);
     }
     return imageStream;
   }
  </code></pre>
  
  <p>but I always get unhandled exception error and my app crashes.</p>
  
  <pre><code>E/StorageException(11819): StorageException has occurred.
  E/StorageException(11819): Object does not exist at location.
  E/StorageException(11819):  Code: -13010 HttpResult: 404
  E/StorageException(11819): StorageException has occurred.
  E/StorageException(11819): Object does not exist at location.
  E/StorageException(11819):  Code: -13010 HttpResult: 404
  E/StorageException(11819): {  "error": {    "code": 404,    "message": "Not Found.  Could not get object",    "status": "GET_OBJECT"  }}
  E/StorageException(11819): java.io.IOException: {  "error": {    "code": 404,    "message": "Not Found.  Could not get object",    "status": "GET_OBJECT"  }}
  </code></pre>
  
  <p>How to handle this exception?
  <a href="https://i.stack.imgur.com/kWreE.png" rel="nofollow noreferrer">Image of exception in VS Code</a></p>