Global Architecture
SOGo6-server is a RESTful API using the Flask framework.
Core
The goal of SOGo 6 is to be modular to easily get new features or services. As such, the code is mainly separated between 4 categories:
-
API: defines the endpoints, the request or response schema.
-
Manager: requests external services (database, dovecot, ldap…)
-
Module: Uses the manager to read or write data. Contains the main logic of any operation
-
Interface: Link between API and Module; Calls the right module, formats the answer and status code for the API. Also catches exceptions.
Errors handling
SOGo 6 defines three Exceptions (app/utils/exceptions.py):
-
RequestException: Raised when something went wrong, meaning a 2xx status code can’t be returned, but SOGo can handle it and the next request may be ok.
-
AggravatedException: Means there is something wrong with SOGo or its external services and SOGo can’t work properly. Admin attention is needed.
-
BugException: Means there is something wrong with the algorithm or code (e.g. having a string instead of an int). A Bug Report is needed.
These Exceptions are raised with the appropriate error defined here /workspace/app/utils/errors.py
An error has a code, a human readable message and an associated http status code if an API response should be done.