Skip to content

App: use trait for errors

Alejandro Domínguez requested to merge aledomu/fractal:errors-ii into master

There is a big match block in fn dispatch_error to handle all error cases, which are modeled with a big enum with many variants. Since there is an error case for each request, this can be changed to isolated data structures that implement a common trait. Done this way, extending and modifying existing error cases becomes easier. Moreover, there is no need to check among so many variants and then run the proper piece of code; traits pass a pointer directly to the function.

Edited by Alejandro Domínguez

Merge request reports