What's the best way to DRY up this error message?