The new schema migration support in fmu-settings raises MigrationError when stored config, mappings, or cache data cannot be migrated.
The API does not handle this error consistently today. MigrationError inherits from ValueError, so some routes already convert it to HTTP 422 through broad ValueError handling. Other routes can return an unhandled HTTP 500.
For example, opening a project currently catches it as a generic ValueError and reports the project as corrupt. The user-config route does not catch it.
Catching the error in each route would also miss errors raised while FastAPI resolves dependencies.
Proposed solution
Add a central FastAPI exception handler for MigrationError.
The handler should:
- Return a consistent HTTP status and response body. HTTP 422 matches the current handling of invalid stored resource data.
- Log the original error with enough detail for troubleshooting.
- Give the GUI a stable error response that it can show to the user.
The new schema migration support in
fmu-settingsraisesMigrationErrorwhen stored config, mappings, or cache data cannot be migrated.The API does not handle this error consistently today.
MigrationErrorinherits fromValueError, so some routes already convert it to HTTP 422 through broadValueErrorhandling. Other routes can return an unhandled HTTP 500.For example, opening a project currently catches it as a generic
ValueErrorand reports the project as corrupt. The user-config route does not catch it.Catching the error in each route would also miss errors raised while FastAPI resolves dependencies.
Proposed solution
Add a central FastAPI exception handler for
MigrationError.The handler should: