Generalize errors

This is only a proposal to get feedback and should be merged after #33.