Fixing undef resp in error condition

When `err` is not `null`, `resp` can be `undefined` which is causing an exception