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

chore: move error parsing backend-side and return error path to frontend #189

Merged
merged 5 commits into from
Nov 9, 2023

Conversation

mmanciop
Copy link
Member

@mmanciop mmanciop commented Nov 9, 2023

No description provided.

Copy link

vercel bot commented Nov 9, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
otelbin ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 9, 2023 3:08pm

@@ -105,6 +105,15 @@ export const validateOtelCol = async (otelcolRealPath: string, configPath: strin
});
};

const extractErrorPath = (errorMessage: string) => {
const errorPathMatch = errorMessage.match(/^(?:((?:\w+\:\:)+(?:\w+))\:\s+).*/);
Copy link
Member

Choose a reason for hiding this comment

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

Question: This regex will fail when the path is not at the beginning of the message, or when there are named pipelines. An alternative could be:

Suggested change
const errorPathMatch = errorMessage.match(/^(?:((?:\w+\:\:)+(?:\w+))\:\s+).*/);
const errorPathMatch = errorMessage.match(/(\w+(::[^: ]+)*):/);

Copy link
Member Author

Choose a reason for hiding this comment

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

I forgot about named pipelines, I'll add some tests for it.

Copy link
Member Author

Choose a reason for hiding this comment

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

About the path not being at the begging of the message: ADOT has an Error: Invalid configuration: prefix that we already today strip. Besides maybe some other prefixes, I would be surprised if that is a Distro-dependent thing. But luckily, with this change, it becomes a distro qualification test, and we will know when we need to make the regex better it :-)

Copy link

sonarcloud bot commented Nov 9, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@bripkens bripkens merged commit 1a13eba into main Nov 9, 2023
29 checks passed
@bripkens bripkens deleted the backend-side-error-parsing branch November 9, 2023 17:13
@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants