O'Reilly logo

Instant Galleria How-to by Nathan Van Gheem

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling errors gracefully (Medium)

If certain images cannot be loaded, handle it in a graceful way so users aren't confronted with a broken, ugly gallery.

Getting ready

There are two types of Galleria errors, fatal, and warnings. Fatal errors will throw a JavaScript exception and stop all following JavaScript from running. Warnings will cause Galleria to not show an image and then present an error box to the user.

Fatal errors can result from the following reasons:

  • Not being able to load the theme file
  • Not finding that target HTML element to create the gallery
  • Hitting the browser stylesheet limit (Internet Explorer related)
  • Not finding the theme
  • Not determining gallery width and height
  • Width or height is too small for displaying gallery

Warnings can result ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required