Implement better error handling
See original GitHub issueFor some reason the JIRA server is randomly throwing authentication errors. I’ll take this up with my IT group. however the python API doesn’t throw any exceptions it just returns a string of the html of the error. For example if I do
jira = Jira(
url=host,
username=user,
password=passwd)
data = jira.jql(q)
if there is an auth error then data comes back as the string content of the html error from jira. It would be nice if the python api would just detect this internally and throw some kind of exception. Otherwise there is a cryptic error later on where I try to index the data structure and get a failure because it is not the correct type.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:15 (11 by maintainers)
Top Results From Across the Web
How to implement complete error handling? - Codegrip
Error handling is when your software is capable to counter or confiscate errors that may have been brought on by a programmer mistake...
Read more >Error Handling Best Practices - Auth0
Error Handling Best Practices · Send error logs to an external service · Use error objects in rules · Use meaningful error code...
Read more >Better error handling in JavaScript | by Iain Collins - Medium
Establishing good error handling conventions in a project can make it easier to improve the user experience of your software, squash mysterious 'unknown...
Read more >Better Error Handling In NodeJS With Error Classes
Use error classes specifically set up for your application;; Implement abstract error handlers;; Always use async/await;; Make errors expressive ...
Read more >Clean Code and the Art of Exception Handling - Toptal
Exception Handling: It's a Good Thing · Always create your own ApplicationError hierarchy · Never rescue Exception · Never rescue more exceptions than...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You would like to incorporate Atlassian specific errors into the raised exception, right? For instance making it clear that a HTTP 403 response on a GET /rest/api/2/permissions request really means that the user doesn’t have administrative privileges?
If so, then I suggest making a base exception class such as AtlassianException or similar, and a subclass exception for all of the different types of errors that can occur. Using the example above, let’s say we have an exception class AtlassianPermissionError that is subclassed from AtlassianException. The
get_all_permissions
method in the Jira module could then be rewritten to the following in order to translate and convey the correct meaning of the HTTP 403 response.The advantages of doing it this way is that the original exception is preserved and that the correct information (i.e. lacking administrative privileges) is conveyed to the user and/or developer. The disadvantage is that exception chaining requires Python 3. However, as Python 2 is EOL, I assume this isn’t a problem.
Any idea when this error handling will be fixed.
i’m facing the same issue. Below is the portion output.