Currently, clnrest throws the following error with status code 401 when a rune does not have the required permissions:
{
"code": 1502,
"message": "Not permitted: ..."
}
At this point, RTL assumes that the user is unauthorised and logs out with a generic message: Authentication Failed. Redirecting to Login.
In an ideal user experience, RTL should handle authorisation on every screen, allowing/blocking operations based on rune restrictions. Until this functionality is ready and prioritised, a temporary solution is to catch the message from the error and replace the generic message on the screen.
Cleaner Error Handling
Initially, the error object was inconsistent for LND, requiring the extraction of correct information from various levels and keys. Now it seems to be more consistent, enabling cleaner code with a standardised error object.
Given that all three implementations send different JSON error objects, it would be cleaner to handle each of them separately.
Refactoring the error-handling (back-end and front-end both) while taking advantage of the improved consistency in the error object can produce cleaner and more maintainable code.
Currently,
clnrest
throws the following error with status code 401 when a rune does not have the required permissions:At this point, RTL assumes that the user is unauthorised and logs out with a generic message:
Authentication Failed. Redirecting to Login.
In an ideal user experience, RTL should handle authorisation on every screen, allowing/blocking operations based on rune restrictions. Until this functionality is ready and prioritised, a temporary solution is to catch the message from the error and replace the generic message on the screen.
Cleaner Error Handling
Refactoring the error-handling (back-end and front-end both) while taking advantage of the improved consistency in the error object can produce cleaner and more maintainable code.