Skip to content

Instantly share code, notes, and snippets.

@tom-tan
Created September 30, 2013 02:47
Show Gist options
  • Save tom-tan/6758818 to your computer and use it in GitHub Desktop.
Save tom-tan/6758818 to your computer and use it in GitHub Desktop.
#!/usr/bin/env rdmd
import std.conv;
import std.exception;
version(unittest) {}
else
void main()
{
// Error: static assert "The error handler's return value(void) does not have a common type with the expression(int)."
int x = "x".to!int.ifThrown!ConvException((e) {
throw new Exception("throwing another exception");
});
// こっちは動く
int y = "y".to!int.ifThrown!ConvException((e) {
throw new Exception("throwing another exception");
return int.init;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment