Fix #775 by catching and handling the thrown exception