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

Get operation can throw when misused. #290

Open
mac01021 opened this issue Jan 3, 2019 · 4 comments
Open

Get operation can throw when misused. #290

mac01021 opened this issue Jan 3, 2019 · 4 comments
Assignees
Labels

Comments

@mac01021
Copy link

mac01021 commented Jan 3, 2019

This may or may not be a bug. I'll leave that up to the authors of the library.

I have the impression that get, query, and other operations are intended never to throw an exception (but instead return Left(someError). However, if you call get('myKey -> "myVal") when 'myKey is not the primary key, then exec will throw an exception from within the AWS dynamodb client.

In my case, the issue was that myKey was only the hashing key and I had neglected to provide a value for the sorting key. Clearly user error, but also still a thrown exception.

@regiskuckaertz
Copy link
Contributor

You're right, this shouldn't happen.

@mac01021
Copy link
Author

mac01021 commented Jan 7, 2019

Out of curiosity, what's the reason for query returning List[Either[Error, Record]] rather than Either[Error, List[Record]]?

@regiskuckaertz
Copy link
Contributor

See #174

We'll be working out a refactor of that soon.

@regiskuckaertz
Copy link
Contributor

regiskuckaertz commented Jan 9, 2019

Technically, the semantics of List[Either[]] is more accurate since errors can occur at the record level. We don't want the whole result to fail if only one record fail, though we don't want to lose that information either. So, I'm not sure Either[List[]] is the right choice here. We need a ScanamoGetResult[A].

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

No branches or pull requests

3 participants