more idiomatic error handling

use Error objects, err variable name and return after calling back with an error