Do not refer to self.app in handle_error

Due to Flask factory pattern, self.app may be None. current_app should be used instead.