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

Log errors returned from graphql #3562

Merged
merged 6 commits into from
Apr 17, 2023

Conversation

WithoutPants
Copy link
Collaborator

Adds an error presenter to the graphql interface that logs any encountered errors to the error log level. Also logs the request arguments at the debug log level when an error is encountered.

@WithoutPants WithoutPants added the improvement Something needed tweaking. label Mar 19, 2023
@WithoutPants WithoutPants added this to the Version 0.20.0 milestone Mar 19, 2023
@WithoutPants
Copy link
Collaborator Author

Added logging for when the user logs in or out, when invalid credentials are entered, and when credentials are changed.

@@ -34,7 +34,15 @@ const (
passwordFormKey = "password"
)

var ErrInvalidCredentials = errors.New("invalid username or password")
type InvalidCredentialsError struct {
Username string
Copy link
Collaborator

@bnkai bnkai Mar 22, 2023

Choose a reason for hiding this comment

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

Is this actually used anywhere? I only see it set when initializing ?
Wouldnt an empty struct be enough?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I originally had this field included in the Error method, but I've taken it out for now (until we support multiple users). Having the field means that we can read the username from the calling code, so it's useful, just not currently in use.

internal/api/error.go Outdated Show resolved Hide resolved
@WithoutPants WithoutPants merged commit 32cefea into stashapp:develop Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Something needed tweaking.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants