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

Extend error response #1022

Merged
merged 5 commits into from
Jan 24, 2024
Merged

Conversation

qazwsxedckll
Copy link
Contributor

  1. add ErrorReason in proto file.
enum ErrorReason {
  USER_NOT_FOUND = 0;
}
  1. return in service
return nil, ErrUserNotFound("not found")
  1. assert error
if IsUserNotFound(err) {
	fmt.Println("user not found")
}

@rogeralsing rogeralsing merged commit f36d1cf into asynkron:dev Jan 24, 2024
2 checks passed
@qazwsxedckll qazwsxedckll deleted the extend-error-response branch March 8, 2024 05:35
@cupen
Copy link
Contributor

cupen commented Mar 27, 2024

@qazwsxedckll Why was the directory name _examples changed back? See #384

@cupen
Copy link
Contributor

cupen commented Mar 27, 2024

@qazwsxedckll Tracking the go.sum file of examples may causing a lot unnecessary changes.

@rogeralsing
Copy link
Collaborator

👋🏻 @cupen

@qazwsxedckll
Copy link
Contributor Author

qazwsxedckll commented Mar 27, 2024

@cupen
It is ignored by go build and I cannot get any lint from vscode even if I add go.work. I understand about removing example dependencies from the main module by adding go.mod to every example.

Maybe there were many problems before go.work came out so add underscore to ignore them make sense. Now we can just run go work init && go work use -r . to add all examples.

I have no opinions on go.sum files.

@cupen
Copy link
Contributor

cupen commented Mar 29, 2024

Hi @rogeralsing @qazwsxedckll To my point of view, these examples are not a part of protoactor-go , but rather some usecases for demonstration purposes. So the examples and protactor-go can be treated as two separate projects, it might be enough to just place a go.work in the examples directory for linter.

So, for avoid the lots of unnecessary changes with go.sum of examples, is there a better way than .gitignore?

btw: These examples also could be the first choice to check our locally modification, so the replace xxx => ./.. in go.mod of examples is useful. And also it could works with go.work.

@qazwsxedckll
Copy link
Contributor Author

qazwsxedckll commented Mar 29, 2024

@cupen First, go.work is not recommanded to be commited to the repository. Run go work init && go work use -r . in the root directory is the way to go. When using go.work, it is alway using the local modifications, no matter the verson chosed in go.mod. When not using go.work, examples are using the version specified in go.mod. I find it is extremely useful. So replace is not neccessay here. You can try it out first.

@cupen
Copy link
Contributor

cupen commented Mar 30, 2024

@qazwsxedckll Yes, that's true. I mistakenly thought you wanted to put a go.work file in the root path for resolve the linter problems, so I suggested use the examples as an alternative. Sorry for that.

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