I have a question about dealing with errors.
The signatures of the Store interface methods don't have error as return value.
What is the best way to deal with errors in this case?
For example, if I use database, in case of error I'd like to return error to the part of code which asked for the method. The Store interface methods don't give me this possibility, so the only way is to return nil and log error. But in some cases I'd like to tell user that something went wrong instead of pretending that session was saved.
For example, I want something like this:
err := session.Add(sessionData, c.Writer)
if err != nil {
// return 500 error
}
But I have only this:
session.Add(sessionData, c.Writer)
// How can I understand that something went wrong?
Do you think if it is possible to add error to the signatures in the next major version of the library?
I have a question about dealing with errors.
The signatures of the
Storeinterface methods don't haveerroras return value.What is the best way to deal with errors in this case?
For example, if I use database, in case of error I'd like to return error to the part of code which asked for the method. The
Storeinterface methods don't give me this possibility, so the only way is to return nil and log error. But in some cases I'd like to tell user that something went wrong instead of pretending that session was saved.For example, I want something like this:
But I have only this:
Do you think if it is possible to add
errorto the signatures in the next major version of the library?