|
|
|
|
|
by indrekju
3037 days ago
|
|
You can. Instead of passing null through the chain you could pass an actual error object. Check out Elixir With statements for example: http://openmymind.net/Elixirs-With-Statement/ We do something similar in ruby with deterministic gem. Each action returns Success(value) or Failure(error). The error object is one of our own defined error instances (e.g. Responses::Unauthorized.new(msg)). These are then translated to actual error codes and messages in the web layer. We added something similar to do-notion for ruby in deterministic gem. Not very nice but makes using deterministic a bit more convenient. https://github.com/pzol/deterministic#chaining-with-in_seque... |
|