Yes, I realize this does return -1 on the error. It is fine to return -1 on user errors, but this is a programming error.