Jormungandr: fix error for wrongly formated tokens

wrongly formated token were resulting with internal error, now we get a nicer error
it can throw a typeerror