Fix session database error handling

Signed-off-by: Kenji Suzuki <kenji.uui@gmail.com>