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

Update spec: return errors as Objects – (and a 'Not Implemented' code?) #11

Open
bblodfon opened this issue Nov 11, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@bblodfon
Copy link
Member

Not all real-world APIs support some of the operations requested by getDictInfos or getEntries for example.
Usually this issue had to do with asking more general information from the APIs - e.g. asking for all dictionary information, all entries (in all possible sub-dictionaries/ontologies).

Thus, the specification should include information on what object should these functions return in these cases.

E.g., it could be something like:

{
  status: 400,
  error: 'Not implemented'
}
@bblodfon bblodfon added the enhancement New feature or request label Nov 11, 2020
@bblodfon
Copy link
Member Author

bblodfon commented Nov 11, 2020

404 as status is better, as it stands for "Not Found"

@bblodfon
Copy link
Member Author

error: 'Not supported' is also better

@stcruy
Copy link
Member

stcruy commented Nov 11, 2020

Yes, the spec would benefit if that were written into it:

  • on error: always return an Object with at least an error property.
  • on error: a status property could be added too. But for now I'd leave it up to each particular ‘vsm-dictionary-xyz’ implementation to specify what that status mean in their case – since this seems to reflect a HTTP error code that is returned by the server of the particular API, addressed by that vsm-dictionary.
  • and add that some functionality (like getting all dictInfos, etc) may not be supported by some APIs. Which means that code that depends on a vsm-dictionary should deal with errors gracefully, and show some flexibility in getting data (e.g. if the user can not query them all, the software should not crash or freeze, but instead enable the user to query them by name).

I'm not convinced we need to require the use particular error Strings. Because that would mean that we take a responsibility to define many more possible error codes, over time. But we have no use-case for it (i.e. to make it machine-interpretable).

I think that modules that call a vsm-dictionary's code simply have to account for the fact that a truthy err means that the data is unavailable, for whatever reason, and they have to deal with that.
The err.error would only server as information to the user. And the Object form would prepare for extensions for real use-cases in the future.

  • ➝ So: the bullet points on top are to-dos.
  • But this then also needs 'vsm-dictionary-local' (and perhaps more) to be updated accordingly, soon after.

@stcruy stcruy changed the title Not Implemented specification Update spec: return errors as Objects – (and a 'Not Implemented' code?) Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants