diia-open-source / be-user-service

European Union Public License 1.2
136 stars 6 forks source link

Backend: error handling #83

Open tshemsedinov opened 3 months ago

tshemsedinov commented 3 months ago

No cause escalation in passing error, it will be complex to find relation between logs, returned error and UI messages. It is a good practice to have global error ID to track it in all services and interfaces, and use error.cause creating errors.

https://github.com/diia-open-source/be-user-service/blob/b45a0e2db354df110a99254516a414aaac43be61/src/services/diiaId.ts#L129-L137

DiiaOpenSource commented 3 months ago

Hi @tshemsedinov

Thank you for paying attention. We do not intend to add error codes to UI messages. On the other hand, we have tracing instruments to track request logs, errors, and other things that happen during a request path. So it's not complex to find a relation between these things. Anyway, we have error ID support in our system (which are named Error Codes and Process Codes), but specifically in this place, it was on purpose to hide an original error from a client because DiiaId (Дія.Підпис) creation is a pretty sensitive process, and we decided to hide such errors from clients to mitigate these information usages in security attacks. Perhaps we should revise this approach, but it's entirely another point of discussion.