rename HttpError to TopheException
factorize some code
tighter check for null