![]() Check HTTP status codes on the response.With that in mind, following this general list and adjusting as necessary for your specific integration should get you (and the user) off to a great start. This list is not all-inclusive, so be mindful of the documentation you are using. You can use this method when a fatal or error scenario has been reached in your code - such as receiving an HTTP 500 error, invalid response, invalid authentication, etc. You can do this with raise PluginException(cause="reason", assistance="helpful message") and then supply a cause and assistance message (as detailed in the above section) to the user for possible remediation. You can do this with (.) to supply an error message to the user.Ī PluginException will halt plugin code execution. When it is not necessary to halt the plugin code, you can log an error but continue execution. There are two general actions you can take as a developer when handling errors. This is a general overview of some code which handles errors effectively and efficiently, while at the same time displaying useful, human-readable, messages to the user. This can lead to unreported errors and wasted time. This includes not explaining what could have caused the failure, not offering remedial steps, and not instructing the user to take proper action. The "bad" message is bad because it does not user proper English and does not offer anything else. The "good" message is good because it details the error (authentication), identifies the authentication credentials as the issue, offers remedial self-service steps towards fixing the issue, and instructs the user to contact support if needed. If the issue persists, please contact support. Please verify your API key configured in your plugin connection is entered correctly and that your Acme Service API key is valid and try again. Good: Error: Authentication to the Acme Service failed. The following are two example error messages - one good, and one bad: When possible, direct users towards potential resolutions to the error and a reminder to test the integration after they resolve the issue Write the error messages with language that aligns with the product you are building the plugin to integrate with. Error MessagesĪll user-facing text should follow proper English grammar/spelling/syntax unless otherwise noted, including error messages. Trust but verify 3rd party API documentation. This guide is built around using the Requests library, although the concepts are relatively code-agnostic. This style guide aims to enable you, the developer, to write better code that handles errors more effectively and in a self-service-oriented manner, ultimately reducing the need for users to contact support. Things don’t always work properly, and your goal should be to minimize customer frustration as much as possible when this happens. Error handling is crucial to building a successful product integration.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |