1616package session
1717
1818import (
19- defaultErrors "errors"
2019 "net/http"
2120 "reflect"
2221
22+ "github.com/supertokens/supertokens-golang/recipe/session/errors"
2323 "github.com/supertokens/supertokens-golang/recipe/session/sessmodels"
2424 "github.com/supertokens/supertokens-golang/supertokens"
2525)
@@ -64,7 +64,7 @@ func newSessionContainer(config sessmodels.TypeNormalisedInput, session *Session
6464 }
6565 if sessionInformation == nil {
6666 clearSessionFromCookie (config , session .res )
67- return nil , defaultErrors . New ( "session does not exist anymore" )
67+ return nil , errors. UnauthorizedError { Msg : "session does not exist anymore" }
6868 }
6969 return sessionInformation .SessionData , nil
7070 }
@@ -76,7 +76,7 @@ func newSessionContainer(config sessmodels.TypeNormalisedInput, session *Session
7676 }
7777 if ! updated {
7878 clearSessionFromCookie (config , session .res )
79- return defaultErrors . New ( "session does not exist anymore" )
79+ return errors. UnauthorizedError { Msg : "session does not exist anymore" }
8080 }
8181 return nil
8282 }
@@ -94,7 +94,7 @@ func newSessionContainer(config sessmodels.TypeNormalisedInput, session *Session
9494
9595 if resp == nil {
9696 clearSessionFromCookie (config , session .res )
97- return defaultErrors . New ( "session does not exist anymore" )
97+ return errors. UnauthorizedError { Msg : "session does not exist anymore" }
9898 }
9999
100100 session .userDataInAccessToken = resp .Session .UserDataInAccessToken
@@ -114,7 +114,7 @@ func newSessionContainer(config sessmodels.TypeNormalisedInput, session *Session
114114 }
115115 if sessionInformation == nil {
116116 clearSessionFromCookie (config , session .res )
117- return 0 , defaultErrors . New ( "session does not exist anymore" )
117+ return 0 , errors. UnauthorizedError { Msg : "session does not exist anymore" }
118118 }
119119 return sessionInformation .TimeCreated , nil
120120 }
@@ -126,7 +126,7 @@ func newSessionContainer(config sessmodels.TypeNormalisedInput, session *Session
126126 }
127127 if sessionInformation == nil {
128128 clearSessionFromCookie (config , session .res )
129- return 0 , defaultErrors . New ( "session does not exist anymore" )
129+ return 0 , errors. UnauthorizedError { Msg : "session does not exist anymore" }
130130 }
131131 return sessionInformation .Expiry , nil
132132 }
0 commit comments