Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow createSession to throw #18

Open
hhanesand opened this issue Nov 11, 2016 · 2 comments
Open

Allow createSession to throw #18

hhanesand opened this issue Nov 11, 2016 · 2 comments

Comments

@hhanesand
Copy link

As I was writing my implementation of the protocol SessionManager, I realized I needed the createSession to be able to throw errors. After I create my session, I need to persist it to the our database, and that introduces a source of possible thrown errors that can not be propagated back to the network stack as createSession can not throw.

Would it be possible to change the method signature of the createSession method from

func createSession(account: Account) -> String

to

func createSession(account: Account) throws -> String

?

This would allow me to return an error in the HTTP request that initiated the session creation if the save operation failed.

@edjiang
Copy link
Contributor

edjiang commented Nov 14, 2016

Yeah, this makes sense. Let me look into this more tomorrow and see what we can do =]

@hhanesand
Copy link
Author

hhanesand commented Nov 15, 2016

I can throw a pull request your way if that makes things easier for you.

patched one together @ #20

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants