Error catching for https