Handling errors in the pictures controller