-
Notifications
You must be signed in to change notification settings - Fork 8
Add a Test Connection button to TestingBot credentials #36
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
Merged
+40
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: testingbot/TestingBot-Jenkins-Plugin
Length of output: 3692
🌐 Web query:
TestingbotREST.java TestingbotApiException non-401 HTTP parse IOException raw GitHub💡 Result:
In the testingbot-java client, the TestingbotApiException is typically raised when the TestingBot API returns a non-2xx HTTP status code that is not handled by specific exception types like TestingbotUnauthorizedException [1]. When you encounter an IOException during the parsing of a non-401 HTTP response, it often indicates that the client received a response body that could not be parsed as expected (e.g., malformed JSON) or that a network-level issue occurred during the request-response cycle [2][1]. To diagnose and resolve this: 1. Verify Credentials: Ensure your TESTINGBOT_KEY and TESTINGBOT_SECRET are correctly set [3][4]. A 401 Unauthorized error specifically points to authentication failures, while other status codes or parsing errors will trigger the general TestingbotApiException [3][1]. 2. Inspect the Raw Response: If the library throws an IOException or TestingbotApiException due to a parsing failure, the underlying cause is often an unexpected response format [2]. Ensure you are not accidentally hitting an HTML error page or a proxy message instead of the expected JSON API response. 3. Check Network/Environment: Network-level issues (such as timeouts or connection resets) can sometimes be misreported if the client attempts to parse an empty or interrupted response stream [5][2]. 4. Library Updates: If you are using an older version of the Java client, consider checking the repository for updates, as newer versions of TestingBot's client libraries have moved toward more robust, typed error hierarchies to better distinguish between transport failures, authentication errors, and API-level errors [5][6]. For debugging purposes, you can often capture the raw response or status code by wrapping the API call in a try-catch block and inspecting the exception object provided by the testingbot-java library [1].
Citations:
🌐 Web query:
site:github.com/testingbot/testingbot-java TestingbotApiException TestingbotUnauthorizedException TestingbotREST.java getUserInfo💡 Result:
In the TestingBot Java REST client library, the getUserInfo method is used to retrieve details about the current user account [1]. This method is part of the TestingbotREST class [1]. When interacting with the TestingBot API via this library, methods like getUserInfo can throw specific exceptions to handle API-related errors [1]: 1. TestingbotApiException: This exception is thrown when an API error occurs, and it typically contains the JSON response from the server as a string, which can be useful for debugging [1]. 2. TestingbotUnauthorizedException: This exception is thrown when the API request fails due to invalid authentication credentials (API key or secret) [1]. To use the client, it is recommended to manage resources properly, for instance by using a try-with-resources block since the TestingbotREST class implements Closeable [1]. An example usage of the getUserInfo method is provided below: try (TestingbotREST restApi = new TestingbotREST("key", "secret")) { TestingbotUser user = restApi.getUserInfo; // Use user object... } catch (TestingbotUnauthorizedException e) { // Handle authentication error } catch (TestingbotApiException e) { // Handle API error }
Citations:
🌐 Web query:
"TestingbotApiException" "TestingbotUnauthorizedException" "TestingbotREST.java" GitHub💡 Result:
The classes TestingbotApiException and TestingbotUnauthorizedException are custom exception types used within the official TestingBot Java client library [1]. This library, available on GitHub as testingbot-java, provides the TestingbotREST class to facilitate interaction with the TestingBot REST API [1][2][3]. According to the library's documentation, all API methods provided by the TestingbotREST class are designed to throw these exceptions when errors occur [1]. Specifically: - TestingbotApiException(String json): Thrown when the API returns an error response [1]. - TestingbotUnauthorizedException: Thrown when an authentication error occurs, typically associated with an invalid API key or secret [1][2]. To integrate this in a Java project, you can add the following dependency (using the version 1.0.10 as referenced in official documentation) [4][5][6]: Maven: com.testingbot testingbotrest 1.0.10 Gradle: implementation 'com.testingbot:testingbotrest:1.0.10' The TestingbotREST class is used to authenticate requests using your TestingBot API key and secret, allowing you to perform actions such as updating test metadata, retrieving test information, or managing browser lists [1][2][3].
Citations:
🏁 Script executed:
Repository: testingbot/TestingBot-Jenkins-Plugin
Length of output: 10836
Separate 401 auth failures from other TestingBot errors.
TestingbotApiExceptioncovers non-401 API errors and transport/parse failures, so this catch block currently labels rate limits, server errors, and malformed responses as “authentication failed.” CatchTestingbotUnauthorizedExceptionseparately, and return a generic “TestingBot request failed” message forTestingbotApiExceptionwithout echoing the raw response body.🤖 Prompt for AI Agents
Source: MCP tools