You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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?
The text was updated successfully, but these errors were encountered:
rumyantseva
changed the title
[Question] The signatures of the Store interface methods
Question: The signatures of the Store interface methods
May 29, 2017
Good idea, it might have been an overlook from my part when designing the API.
Similarly, if we proceed to add an error return value too to the Store methods, we should do the same with the Manager interface (a Manager implementation uses a Store implementation under the hood, and it is reasonable / makes sense to "delegate" the errors returned by the used Store).
I have a question about dealing with errors.
The signatures of the
Store
interface methods don't haveerror
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:
But I have only this:
Do you think if it is possible to add
error
to the signatures in the next major version of the library?The text was updated successfully, but these errors were encountered: