Skip to content

feat:error handling and region support #138

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

Closed
wants to merge 2 commits into from

Conversation

Amitkanswal
Copy link
Contributor

Support-

  • Proper error handling
  • Hosting service urls support

@Amitkanswal Amitkanswal requested a review from rijil-tr March 13, 2025 09:53
@Amitkanswal Amitkanswal requested a review from a team as a code owner March 13, 2025 09:53
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances error handling and adds support for hosting service URLs. Key changes include:

  • Introducing new type definitions (ServiceURLsMap, RequestInitConfig, RequestConfigWithBaseUrl) to support service URLs.
  • Updating API request adapters and utility functions to integrate error handling and URL resolution.
  • Modifying the UI location module to utilize the new hosted endpoints configuration.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/types/api.type.ts Added new types for service URL and request configuration support.
src/utils/adapter.ts Updated dispatch functions with improved error handling and integration of hosted URLs.
src/utils/utils.ts Modified fetchToAxiosConfig and added isAbsoluteURL with baseURL resolution.
src/uiLocation.ts Updated the API method to include hostedEndpoints for service URL support.
src/types.ts Integrated new hosted endpoints config and extended region enums.
Comments suppressed due to low confidence (1)

src/utils/utils.ts:54

  • Consider adding an explicit type annotation to the 'url' parameter (e.g., url: string) to improve type clarity and safety.
function isAbsoluteURL(url) {

@Amitkanswal Amitkanswal requested a review from rijil-tr March 20, 2025 07:30
@Amitkanswal Amitkanswal requested a review from rijil-tr March 21, 2025 07:56
return response

} catch (error) {
throw handleApiError(error);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to throw this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need errors to be catched on user side right? If I do return errors are going as response

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you are returning response object in all cases right? Can check your implementation is fetch compatible?

@Amitkanswal Amitkanswal force-pushed the feat/MKT-11337-error-hosting-support branch from d6daa79 to 9976df2 Compare March 25, 2025 07:45
@Amitkanswal Amitkanswal requested review from rijil-tr and Copilot April 1, 2025 05:50
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces improved error handling and support for hosting service URLs by updating error processing logic and configuration types. Key changes include:

  • Adding a new function (handleApiError) for unified error responses.
  • Refactoring region handling to use a broader type (RegionType) and incorporating endpoints into configuration.
  • Adjusting adapter logic to include additional response properties and updating tests accordingly.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/utils/utils.ts Introduces new error handling utilities and region logic
src/utils/adapter.ts Refactors API dispatch, adding unified error handling
src/uiLocation.ts Adjusts region type usage and adds endpoints support
src/types/api.type.ts Adds endpoints type
src/types.ts Updates region and endpoints integration
test/*.test.ts Updates tests to align with new region and endpoints changes

@Amitkanswal
Copy link
Contributor Author

closing this PR as it was pending for long time creating a new PR

@Amitkanswal Amitkanswal closed this Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants