Are you sure these will be in the `err` variable? I think you need to test `res` not `err`.