Check for errors when saving options and report them.

Fixes #5830