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

feat: error transfer between typescript and golang #5676

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

CatalinSnyk
Copy link
Contributor

@CatalinSnyk CatalinSnyk commented Jan 22, 2025

Pull Request Submission Checklist

  • Follows CONTRIBUTING guidelines
  • Includes detailed description of changes
  • Contains risk assessment (Low | Medium | High)
  • Highlights breaking API changes (if applicable)
  • Links to automated tests covering new functionality
  • Includes manual testing instructions (if necessary)
  • Updates relevant GitBook documentation (PR link: ___)

What does this PR do?

Iterating on the work from #5626, this adds the possibility of sending errors originating from the TypeScript CLI to our Golang CLI. The errors are wrapped in our generic Error Catalog model before being serialized as JSON API errors and written in the temporary error file used as a mean for IPC.

Where should the reviewer start?

How should this be manually tested?

Related

CLI-646

Copy link
Contributor

github-actions bot commented Jan 22, 2025

Warnings
⚠️

Since the CLI is unifying on a standard and improved tooling, we're starting to migrate old-style imports and exports to ES6 ones.
A file you've modified is using either module.exports or require(). If you can, please update them to ES6 import syntax and export syntax.
Files found:

  • src/cli/main.ts
⚠️ There are multiple commits on your branch, please squash them locally before merging!

Generated by 🚫 dangerJS against a7153b6

@@ -29,6 +27,7 @@ import (
"github.com/snyk/go-application-framework/pkg/instrumentation"
"github.com/snyk/go-application-framework/pkg/local_workflows/network_utils"
"github.com/snyk/go-application-framework/pkg/local_workflows/output_workflow"
_ "github.com/snyk/go-application-framework/pkg/networking/fips_enable"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Issue: please move this to be the first import ;)

return err
}

data, fileErr := os.ReadFile(filePath)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggestion: I'm contemplating if we should be more tolerant and allow the file to be optional? Because otherwise we might fail to run to the end and show the actual issue.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also I guess you might be able to move this logic to its own function

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.

3 participants