Add Domain Specific Error Handling for Trampoline Payments#604
Merged
Conversation
bc74d44 to
70581bd
Compare
Collaborator
|
Very nice changes. I'd just like to move the error into a separate module, so we don't make |
cdecker
requested changes
Jun 23, 2025
Introduces a custom error module, providing a comprehensive error handling system. The module offers a generic, extensible approach to error management with rich context. Key features: - Generic GreenlightError<C> type that works with custom error codes - Seamless conversion between custom errors and tonic::Status - Structured error details with JSON serialization for gRPC transport - User-friendly messages with optional hints for resolution The framework enables consistent error handling across services while maintaining gRPC compatibility and providing detailed error information for both users and developers. Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
Migrates from generic anyhow::Error to strongly-typed TrampolineError throughout the trampoline_pay implementation. This provides better error categorization and improved diagnostics. Changes: - Implement TrampolineError using the greenlight_error framework - Define TrampolineErrCode enum with specific error cases (42701-42714) - Add conversion from CLN RPC errors with code preservation - Replace all anyhow::Error usage with appropriate TrampolineError types - Add convenience constructors for common error scenarios Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
In order to access the TrampolineError from the internal gl plugin we need to make it public. Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
When hitting an error on trampoline_pay we just reported a generic status UNKNOWN to the caller. This commit wires the actual status trhough. This allows the caller to receive a detailed explaination of the underlying error that caused the failed payment. Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
We wan't to be able to use the error framework across diferent greenlight crates. The util crate is a good place to store some common functionalities. Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
Signed-off-by: Peter Neuroth <pet.v.ne@gmail.com>
79c0ff8 to
caf1005
Compare
Collaborator
|
Rebased and going to merge asap. This likely forces us to make the next update a major version bump, but that's ok, we're getting new functionality with it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a comprehensive error handling framework for trampoline payments, replacing generic
anyhow::Errorusage with strongly-typed, domain-specific errors. The error handling provides better error categorization, improved diagnostics, and seamless gRPC integration. It also adds rich error context with hints for developers and users while surviving serialization into gRPC statuses for usage across service boundaries.