^ :thread-please:
# ktor
d
^ đź§µ
do you have a small snippet reproducing the problem?
v
I have only a test route with val session = call.mySession as you said to do and I have the error When I tried to access this route with bad header and after the server crash
If you want I can give you the exception ?
d
Is it ktor 0.9.2, with netty?
how are you installing the sessions feature?
(the configuration I mean)
v
Yes it 0.9.2 with netty
Like this : install(Sessions) { header<AnniaSession>( “ANNIA_SESSION”, directorySessionStorage(File(“.sessions”), cached = true) ) }
d
to seer which storage
that meanas that the session has been deleted
v
But is it normal that the server crash ?
d
well it doesn’t crash, only throws an exception for that route
v
Ok so I need to try and catch all the call.mySession ?
d
I guess it fails before entering the route
let me check
v
Ok thanks
d
looks like a problem to me, please report it here: https://github.com/ktorio/ktor/issues and we will fix as soon as possible
in the meantime you can grab ktor source code locally, wrap these lines around a
try-catch
`NoSuchElementException`: https://github.com/ktorio/ktor/blob/0a45746af0db0457a6e1e988c27d9364cf064962/ktor-server/ktor-server-core/src/io/ktor/sessions/Sessions.kt#L30-L36
./gradlew install
And use 0.9.2-SNAPSHOT
v
Thanks, just what is the difference between 0.9.2 and 0.9.2-SNAPSHOT please ?
d
For unexistant sessions that are not available, would be like if no session was provided and you can do whatever you need in your route handler
-SNAPSHOT is not published
if you install the code from master right now
the version would be 0.9.2-SNAPSHOT
that’s why if you apply a fix locally you have to reference to 0.9.2-SNAPSHOT
v
Ok thank for your help
d
and include
repositories { mavenLocal() }
in your
build.gradle
before any other maven repo, so it gets your local installed version
👍 1
v
d
Ok I have checked this
it displays a DEBUG message with the error
but executes the handler
and when calling
call.sessions.get<MySession>()
it returns null