Path in Error type


In the android implementation of apollo-runtime 2.5.9 the Error class does not have a ‘path’ field or at least not that I can find. Is it or going to be supported.


Good catch! Not sure why it wasn’t there in the first place. Most likely an oversight. Pull Request to fix this: Add error.path by martinbonnin · Pull Request #3284 · apollographql/apollo-android · GitHub

Digging a bit more into this, 2.5.9 exposes the path in customAttributes (from this PR). So you can access it with:


I’m not sure why it was made this way. The documentation referenced in the above PR is now offline and the specification doesn’t allow customAttributes. Instead, it allows a generic "extensions" object.

All in all:

  • In 2.x, use error.customAttributes().get("path") to access the path. Adding error.path would be a breaking change so not considered at this point.
  • In 3.x, we’ll expose error.path and error.extensions to match the spec (PR there).
1 Like