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

Add "Resource Not Found" errors in opslevel-go #496

Open
rocktavious opened this issue Dec 23, 2024 · 0 comments
Open

Add "Resource Not Found" errors in opslevel-go #496

rocktavious opened this issue Dec 23, 2024 · 0 comments

Comments

@rocktavious
Copy link
Collaborator

rocktavious commented Dec 23, 2024

Customer calling code looks like this

	service, err := client.GetService(serviceIdentifier)
	if err != nil {
		resp.Diagnostics.AddError("opslevel client error", fmt.Sprintf("Unable to read service, got error: %s", err))
		return
	}

But there are cases where service == nil and service.Id == nil which this doesn't handle which means it passes the client code error handling and they have to do this

	service, err := client.GetService(serviceIdentifier)
	if err != nil || service == nil || service.Id == nil {
		resp.Diagnostics.AddError("opslevel client error", fmt.Sprintf("Unable to read service, got error: %s", err))
		return
	}

We should fix this by adding a custom "Resource Not Found" error that we emit when service == nil || service.Id == nil but it should be done in the client.GetService function.

Then wash, rinse, repeat for all "get" functions in the opslevel-go client.

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

No branches or pull requests

1 participant