Package migration, part 1: move exceptions to core.