X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Futils.cpp;h=5a5dc0487c0f1bf4dbd9132143e14567d7c30574;hb=c8df43e7794dc82d5604dfa612e464bbc5ca3cdd;hp=5222f76024438deda488a6ec847b677244d14d0a;hpb=df006bfbbe8e8b49a52296f42894d4a452ed4c90;p=libs%2Fnet.git diff --git a/source/utils.cpp b/source/utils.cpp index 5222f76..5a5dc04 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of libmsphttp -Copyright © 2009 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - #include #include #include @@ -72,7 +65,7 @@ string urldecode(const string &str) if(c=='%') { if(i+3>str.size()) - throw InvalidParameterValue("Malformed data"); + throw invalid_argument("urldecode"); result += lexical_cast(str.substr(i+1, 2), "x"); i += 2; } @@ -98,13 +91,14 @@ Url parse_url(const string &str) return url; } else - throw InvalidParameterValue("Invalid URL"); + throw invalid_argument("parse_url"); } string build_url(const Url &url) { if(!url.path.empty() && url.path[0]!='/') - throw InvalidParameterValue("Only absolute paths are supported"); + throw invalid_argument("build_url"); + string str; if(!url.scheme.empty()) str += url.scheme+"://";