Yerlan
07/26/2020, 7:57 AMawait this.client.movieList.update({
where: { id: parseInt(listId) },
data: {
movies: {
delete: { id: parseInt(movieId) },
},
},
});
In this case, if movieList doesn't contain movie with id=movieId, It's throwing errorRichard Ward
07/26/2020, 1:55 PMSimon
08/10/2020, 9:01 PMupdate() threw for me in prod, but I couldn't find any indication from the docs that this method might throw. If this is intentional behaviour, it certainly seems like something that should be documented.
Are there any other methods I should know about that will throw in undocumented ways?Ryan
08/11/2020, 7:44 AMupsert for that.Simon
08/11/2020, 7:09 PMSimon
08/11/2020, 7:12 PMupdate() method leveraged TypeScript instead of runtime exceptions, it could return some kind of well-typed result object with { success: boolean, result: T } or something similar to avoid throwing and enforce via TS that all edge cases are handled by the programmer. Does that make sense?