D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 11338 - std.uri URIerror should be an Exception
Summary: std.uri URIerror should be an Exception
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P2 trivial
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-24 02:45 UTC by Danny Arends
Modified: 2020-03-21 03:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Danny Arends 2013-10-24 02:45:55 UTC
I'd like to be able to use the following code

import std.uri;

string req_uri;
try{
  req_uri = decode(unsafeUserString);
}catch(Exception e){
  req_uri = "/";
}

Currently it throws an Error... an error (Non-recoverable) is a bit harsh IMHO
Comment 1 github-bugzilla 2013-11-01 09:20:07 UTC
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/1fd19c2366e3d1f41ddff5adc3d73820faf56ad4
Fix of Issue 11338

- URIerror renamed to URIexception
- URIexception class inherits from Exception

https://github.com/D-Programming-Language/phobos/commit/fa0627b21854a3d7be461da20632e474d07c4b66
Fix Issue 11338
- Now call the onOutOfMemoryError() function when alloca returns NULL
- Fixed the URIexception name to URIException
- Added a string constructor for the URIException class
- Added more informative messages to some of the errors

https://github.com/D-Programming-Language/phobos/commit/74d59dd7db418126f323586bcc9a09ca6b69b69a
Fixing Issue 11338 - Additional

- Now all thrown URIException have human readable text
- throw new OutOfMemoryError("Alloca Failure"); // Make code look more consistant

https://github.com/D-Programming-Language/phobos/commit/42eec50ffe2f315dfb8caac3b8c110058115b880
Merge pull request #1659 from DannyArends/issue_11338

Fix Issue 11338 - std.uri URIerror should be an Exception
Comment 2 basile-z 2015-11-27 16:54:23 UTC
auto close failure:

https://github.com/D-Programming-Language/phobos/pull/1659