isomerpages / isomercms-backend

A static website builder and host for the Singapore Government
5 stars 1 forks source link

feat: introduce types for isomer error #792

Closed harishv7 closed 1 year ago

harishv7 commented 1 year ago

Problem

This PR introduces the base types for Isomer Errors

Closes IS-210

Solution

In contrast to the description of task, instead of overloading the logger's error method, we decided to treat logger and error distinctly

Current logger accept a Loggable which is a string or Record<string, unknown> which is a structured log format.

All errors and other types which can be logged will therefore provide a utility function that convert them to one of the above - string or a Record

Hence instead of the logger figuring out how to convert IsomerError and potentially other types in future, it will only accept fixed and predictable types

Breaking Changes

harishv7 commented 1 year ago

Just for clarity, we would then need to have the same definition in the FE for the InternalIsomerError correct?

@kishore03109 FE only receives IsomerExternalError and yes, FE will maintain the same contract and hence definition of the external error type