Improve performance when computing partitions domain summary

This brings down the computation time from 70s (for 12k partitions) down to 250ms on my mac.
The previous algorithm was O(N^2) on the number of partitions times some non-obvious factor due
to how SortedRangeSet.union is implemented. There's still some room for improvement there.
Categorize user errors

* Categorize a bunch of illegal argument exceptions as user errors
* Categorize division by zero as a user error