We have a GraphQL server which sends data to the front end client. We have other tenants who will use our sever and host their code. I want to create a system where they all can create any custom exceptions if they want or they can use some of the exceptions that the server can provide like DependencyFailure. Also error code and isRetryable should be sent to clients.
For this I was thinking I can extend runtime exception (and add some common fields like isRetryable and error code). Will call this BaseException. This will have many constructors with all param combinations: message, retryable, error code, throwable cause.
Now I don't understand how to implement DependencyFailure (and other server provided exceptions). Should it have the parameters like error code and isRetryable customisable by tenants? What if a tenant wants to throw DependencyFailure but make it retryable? If I make it customisable there won't be any difference between BaseException and DependencyFailureException.