-
Notifications
You must be signed in to change notification settings - Fork 161
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
Improve error messages and log levels #1984
Comments
I think we need a way to id updated error messages. We probably need to consider error type updates too in this. |
To expand on that last thought. I was thinking instead of OperationError we should have unique error codes for every error site. This way we can embed more data via traits like https://github.com/dtolnay/thiserror My thinking is we can then have categories of error too like:
We can the make every error site a unique code, and then we can class errors. It would be interesting if there is a way to nest these lik:
That way we can have HTTP status codes set based on the Error class. The classes I was thinking are:
And probably more I'll think of later. The reason I was thinking unique codes, is then we can also have the what/why/how steps in the error descriptor, so we can present this properly to clients and logs, and it means if someone says "Hey, I keep hitting E_ATTRUNIQUE0003" we can precisely locate exactly what error it is in the code too. I think it'll make for more work to add errors, but it'll allow better error management and fault resolution steps. What do you think? |
I also wonder if there are possibly ways we could have errors that are "resolveable" where we can then queue up a fault management task to auto-resolve the issues? |
I definitely think the error codes idea is a good one - windows event codes or rust's compiler codes are very good examples of prior art. |
Okay, lets do it then. I think we make a dedicated kanidm_error library, then everything else can draw on that. I think we can have a bridge for now for the new error type into OperationError and then we can work from "bottom up" replacing everying in the main server in small batches. How does that sound? |
Sounds like a plan to me 🥳 |
I think we need to do a bit of an audit of our logging messages. Currently we have a bit of a mix of things, and that leads to great messages like:
Which even as the author of most of the project, I have no idea what the error was since we don't list the file name.
I think we need a big effort to update messages to:
The text was updated successfully, but these errors were encountered: