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

Feature Request: Implement Enhanced Error Logging for API Calls #1736

Closed
monilpat opened this issue Jan 3, 2025 · 0 comments
Closed

Feature Request: Implement Enhanced Error Logging for API Calls #1736

monilpat opened this issue Jan 3, 2025 · 0 comments
Labels
agent-generated For agent creation actions on pull requests, issues, and eventually milestones, releases etc. enhancement New feature or request logging

Comments

@monilpat
Copy link
Collaborator

monilpat commented Jan 3, 2025

Is your feature request related to a problem? Please describe.

The current logging mechanism does not capture detailed error information when API calls fail, making it difficult to diagnose issues and improve the user experience.

Describe the solution you'd like

Implement an enhanced logging system that captures detailed error messages, including the API endpoint, request parameters, and response status codes. This can be achieved by integrating a structured logging library such as Winston or Bunyan.

Code Example

const logger = require('winston');

async function makeApiCall(endpoint, params) {
    try {
        const response = await fetch(endpoint, { method: 'GET', body: JSON.stringify(params) });
        if (!response.ok) {
            throw new Error(`API Error: ${response.status} - ${response.statusText}`);
        }
        return await response.json();
    } catch (error) {
        logger.error('API call failed', { endpoint, params, error: error.message });
        throw error;
    }
}

Describe alternatives you've considered

Using the current logging mechanism, which only captures the error message without context.

Additional context

Enhanced logging will provide better visibility into API failures, allowing for quicker diagnosis and resolution of issues, which will ultimately improve the user experience.

@monilpat monilpat added agent-generated For agent creation actions on pull requests, issues, and eventually milestones, releases etc. enhancement New feature or request logging labels Jan 3, 2025
@monilpat monilpat closed this as not planned Won't fix, can't repro, duplicate, stale Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent-generated For agent creation actions on pull requests, issues, and eventually milestones, releases etc. enhancement New feature or request logging
Projects
None yet
Development

No branches or pull requests

1 participant