|
|
|
|
|
by asztal
707 days ago
|
|
This has happened to me multiple times with AWS SDK V3 (and other packages like react, cassandra-driver, etc.) and while there are ways to avoid it, it's not entirely simple to prevent. Sadly, the most robust solution is often to use duck typing, e.g. instead of checking if the error is an instance of ResourceNotFoundError, check if error.code equals "ResourceNotFound" which works even if there are multiple library versions present. This is especially the case if you're writing a library that might be provided an instance of an AWS SDK v3 client, as it could be a different version. I've been doing this stuff for 20 years so I'm used to it, I just feel bad for the novices. |
|
I actually considered the looser validation when I discovered that toHaveReceivedAnyCommand() worked, but, ultimately decided there *had* to be something wrong with my setup and I refused to leave it to hit someone else.
Shame the AWS SDK doesn't communicate the actual error in a more human readable way. I was legitimately questioning my sanity and/or the validity of the library for a minute there.