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: Print entity identifier in errors #199

Merged
merged 1 commit into from
Aug 10, 2020
Merged

Conversation

cwurm
Copy link
Contributor

@cwurm cwurm commented Aug 10, 2020

When dealing with many errors, it can be hard to map the error messages (which all appear together at the very end of the output) to the entities (which appear all before). This PR adds information about the kind of entity and the entity identifier to the error messages.

Before (showing just one error for brevity, and coincidentally the identifier is also in the error message - however, this really matters esp. when there are dozens of errors and the errors have less detail):

$ deck sync -s .
creating consumer acl21
Summary:
  Created: 0
  Updated: 0
  Deleted: 0
Error: 1 errors occurred:
		while processing event: {Create} failed: 409 Conflict {"message":"UNIQUE violation detected on '{username=\"acl21\"}'","name":"unique constraint violation","fields":{"username":"acl21"},"code":5}

After:

$ deck sync -s .
creating consumer acl21
Summary:
  Created: 0
  Updated: 0
  Deleted: 0
Error: 1 errors occurred:
		while processing event: {Create} consumer acl21 failed: 409 Conflict {"message":"UNIQUE violation detected on '{username=\"acl21\"}'","name":"unique constraint violation","fields":{"username":"acl21"},"code":5}

Notice the additional detail in while processing event: {Create} consumer acl21 failed:.

@cwurm cwurm requested a review from hbagdi August 10, 2020 13:52
Copy link
Member

@hbagdi hbagdi left a comment

Choose a reason for hiding this comment

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

Thank you for this great enhancement!
I'm surprised with the surprisingly small diff and the value this is going to provide.

@hbagdi hbagdi merged commit 8242ada into Kong:main Aug 10, 2020
@cwurm cwurm deleted the errors_entity_names branch August 10, 2020 17:30
rainest pushed a commit that referenced this pull request Apr 21, 2021
When dealing with many errors, it can be hard to map the error messages (which all appear together at the very end of the output) to the entities (which appear all before). This PR adds information about the kind of entity and the entity identifier to the error messages.

*Before (showing just one error for brevity, and coincidentally the identifier is also in the error message - however, this really matters esp. when there are dozens of errors and the errors have less detail):*
```ShellSession
$ deck sync -s .
creating consumer acl21
Summary:
  Created: 0
  Updated: 0
  Deleted: 0
Error: 1 errors occurred:
		while processing event: {Create} failed: 409 Conflict {"message":"UNIQUE violation detected on '{username=\"acl21\"}'","name":"unique constraint violation","fields":{"username":"acl21"},"code":5}
```

*After:*
```ShellSession
$ deck sync -s .
creating consumer acl21
Summary:
  Created: 0
  Updated: 0
  Deleted: 0
Error: 1 errors occurred:
		while processing event: {Create} consumer acl21 failed: 409 Conflict {"message":"UNIQUE violation detected on '{username=\"acl21\"}'","name":"unique constraint violation","fields":{"username":"acl21"},"code":5}
```

Notice the additional detail in `while processing event: {Create} consumer acl21 failed:`.

From #199
AntoineJac pushed a commit that referenced this pull request Jan 23, 2024
When dealing with many errors, it can be hard to map the error messages (which all appear together at the very end of the output) to the entities (which appear all before). This PR adds information about the kind of entity and the entity identifier to the error messages.

*Before (showing just one error for brevity, and coincidentally the identifier is also in the error message - however, this really matters esp. when there are dozens of errors and the errors have less detail):*
```ShellSession
$ deck sync -s .
creating consumer acl21
Summary:
  Created: 0
  Updated: 0
  Deleted: 0
Error: 1 errors occurred:
		while processing event: {Create} failed: 409 Conflict {"message":"UNIQUE violation detected on '{username=\"acl21\"}'","name":"unique constraint violation","fields":{"username":"acl21"},"code":5}
```

*After:*
```ShellSession
$ deck sync -s .
creating consumer acl21
Summary:
  Created: 0
  Updated: 0
  Deleted: 0
Error: 1 errors occurred:
		while processing event: {Create} consumer acl21 failed: 409 Conflict {"message":"UNIQUE violation detected on '{username=\"acl21\"}'","name":"unique constraint violation","fields":{"username":"acl21"},"code":5}
```

Notice the additional detail in `while processing event: {Create} consumer acl21 failed:`.

From #199
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.

2 participants