Fix base_url construction and define a missing exception class