Use 2.6+ exception 'as e' syntax

(Includes cases not previously touched in this pull request)
Rename msg to error