chulkilee / ex_force

A Salesforce REST API wrapper for Elixir
https://hex.pm/packages/ex_force
MIT License
38 stars 27 forks source link

`query_stream` should handle possible `{:error, _}` response #49

Closed suranyami closed 3 years ago

suranyami commented 3 years ago

We encountered a case where a query_stream can return an :error.

For us it occurred when an SObject had fields that had been renamed since the last time we connected and we had used a query for an old field name.

We have added case statements for the possible :error return state.

Because ex_force was not expecting a {:error, something} result, it would throw a runtime exception, which would bring down the parent GenServer.

We will now be able to expect a possible :error return ourselves and handle gracefully. In our specific case, we will make a new metadata SOAP request to update the known field names for the objects we wish to query. This is a side-effect of not being able to issue SELECT * FROM something queries in Salesforce query language.

PR with fix here: https://github.com/chulkilee/ex_force/pull/48

suranyami commented 3 years ago

50 Does a better job of fixing this than #48, so closing this issue.