Don't call resolve when there's an error, call reject instead.