While this is kinda acceptable, I still think that better to have / than empty string, as it would be more understandable for user.
As for end slash, you can just remove it, if you want prefix without it. No need to error out