Use Try rather than Injection for long conversion

This method is a bit more resistant to errors and was suggested
by @johnynek