Add generic exception threatment to the session lifecycle. Close #27
Merge branch 'enhancement-#27' into develop