session: improve error reporting