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

fix(notifications): More descriptive notifications #260

Merged
merged 3 commits into from
Feb 6, 2024

Conversation

mwangggg
Copy link
Member

Welcome to Cryostat3! 👋

Before contributing, make sure you have:

  • Read the contributing guidelines
  • Linked a relevant issue which this PR resolves
  • Linked any other relevant issues, PR's, or documentation, if any
  • Resolved all conflicts, if any
  • Rebased your branch PR on top of the latest upstream main branch
  • Attached at least one of the following labels to the PR: [chore, ci, docs, feat, fix, test]
  • Signed all commits using a GPG signature

To recreate commits with GPG signature git fetch upstream && git rebase --force --gpg-sign upstream/main


Related to cryostatio/cryostat-web#1192

aali309
aali309 previously approved these changes Jan 23, 2024
Copy link
Contributor

@aali309 aali309 left a comment

Choose a reason for hiding this comment

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

Looks good.

@aali309
Copy link
Contributor

aali309 commented Jan 23, 2024

/build_test

Copy link

You do not have permission to run the /build_test command. Please ask @cryostatio/reviewers
to resolve the issue.

@mwangggg
Copy link
Member Author

/build_test

Copy link

You do not have permission to run the /build_test command. Please ask @cryostatio/reviewers
to resolve the issue.

@andrewazores
Copy link
Member

Weird.

image

@mwangggg
Copy link
Member Author

seems to be just ths PR :/

Copy link
Member

@andrewazores andrewazores left a comment

Choose a reason for hiding this comment

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

Here's a rough idea:


public static class RuleExistsException extends EntityExistsException {
  RuleExistsException(String name) {
    super("Rule", name);
  }
}

public static class EntityExistsException extends ClientErrorException {
  EntityExistsException(String type, String name) {
    super(String.format("%s with name %s already exists", type, name), Response.Status.CONFLICT);
  }
}

and then move the @ServerExceptionMapper into ExceptionMappers.java and have it check e instanceof EntityExistsException instead of the Rule-specific one.

WDYT?

@mwangggg mwangggg force-pushed the 1120-descriptive-errors branch from 41cd325 to 17f6528 Compare February 6, 2024 17:33
@mwangggg
Copy link
Member Author

mwangggg commented Feb 6, 2024

Here's a rough idea:

public static class RuleExistsException extends EntityExistsException {
  RuleExistsException(String name) {
    super("Rule", name);
  }
}

public static class EntityExistsException extends ClientErrorException {
  EntityExistsException(String type, String name) {
    super(String.format("%s with name %s already exists", type, name), Response.Status.CONFLICT);
  }
}

and then move the @ServerExceptionMapper into ExceptionMappers.java and have it check e instanceof EntityExistsException instead of the Rule-specific one.

WDYT?

should this also be an EntityExistsException?
https://github.com/cryostatio/cryostat3/blob/bd6f61d05436f26fcbf8d3edd27e767be21dc8c9/src/main/java/io/cryostat/recordings/RecordingHelper.java#L157-L160

@andrewazores
Copy link
Member

Yup, looks like that would make sense.

@mwangggg mwangggg force-pushed the 1120-descriptive-errors branch from 23c0ac4 to d6743d6 Compare February 6, 2024 18:57
@mwangggg
Copy link
Member Author

mwangggg commented Feb 6, 2024

I moved the EntityExistsException class out to the io.Cryostat package since it's being used by both recordings and rules- let me know if there's somewhere better to put it? Or I could rename and leave the file as a general place for new exceptions that are used by more than one component of Cryostat...

@mwangggg mwangggg force-pushed the 1120-descriptive-errors branch from 3697c51 to e5a8e17 Compare February 6, 2024 19:41
@mwangggg mwangggg force-pushed the 1120-descriptive-errors branch from 9747f37 to 2858693 Compare February 6, 2024 19:42
@andrewazores
Copy link
Member

/build_test

Copy link

github-actions bot commented Feb 6, 2024

Workflow started at 2/6/2024, 2:52:24 PM. View Actions Run.

Copy link

github-actions bot commented Feb 6, 2024

CI build and push: All tests pass ✅
https://github.com/cryostatio/cryostat3/actions/runs/7805294974

1 similar comment
Copy link

github-actions bot commented Feb 6, 2024

CI build and push: All tests pass ✅
https://github.com/cryostatio/cryostat3/actions/runs/7805294974

@andrewazores andrewazores merged commit 85d60c7 into cryostatio:main Feb 6, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants