Binding URL on go.Picture & handle error usecase

I am trying to handle error usecase with go.Picture element, go.Picture element is binded with dynamic URL to load like for example :

                        $(go.Picture, {
                              width: 55,
                              height: 55
                          },
                          new go.Binding("source", "img")
                        )

Incase the URL is corrupted or storage remove the images then url will not load image & hence blank image is displayed. I just want to show default image in that case.

I tried looking into successFunction but i dont think on error this will help out.
Any clue will be greatly appreciated.

Try setting https://gojs.net/latest/api/symbols/Picture.html#errorFunction

Thanks for the reply.

I tried the errorFunction like below, but its not been invoked when url is hitted & error is 404 on that image url on console

                          $(go.Picture, {
                              width: 55,
                              height: 55
                          },
                          {
                            errorFunction: function(picture,eve) {
                              console.log("Inside error loading image");
                                picture.source = errorImage;
                            }
                          },
                          new go.Binding("source", "img")
                        )

I just tried it, and I find that the Picture.errorFunction does indeed get called. I have a similar Picture:

    $(go.Picture, "nonexistent.jpg",
      {
        width: 50, height: 50,
        errorFunction: function(pic, e) {
          pic.diagram.commit(function() {
            pic.source = "../samples/images/hs1.jpg";
          }, null);  // null means temporarily set skipsUndoManager to true
        }
      })

The console & network activity shows getting a 404 error, and the errorFunction is called, substituting the image source successfully.

I also tried it so that the substitute image source would result in 404 errors, and that worked correctly too, causing the Picture not to show anything at all.