Fix syntax and incorrect usage of log exception