Repository: bas-amop/PolarRoute-server

Issue:
Redundant `"error:"` message nesting in failed job response
See this job response for a failed route calculation:

```json
{
    "id": "2c9ee2bd-ec49-4d63-ae67-89ef8fcf9cf0",
    "status": "FAILURE",
    "route_id": "8",
    "created": "2025-11-14T17:44:52.031714Z",
    "info": {
        "error": {
            "error": "Inaccessible. No routes found."
        }
    },
    "polarrouteserver-version": "0.2.4"
}
```
We can remove one layer of `"error": {}`

Discussion:

Fix (patch):
diff --git a/polarrouteserver/route_api/serializers.py b/polarrouteserver/route_api/serializers.py
index 77a4984..1e396f6 100644
--- a/polarrouteserver/route_api/serializers.py
+++ b/polarrouteserver/route_api/serializers.py
@@ -65,7 +65,7 @@ def get_info(self, obj):
         """Include error info when job failed."""
         result = self._get_celery_result(obj)
         if result.state == "FAILURE":
-            return {"error": obj.route.info}
+            return obj.route.info
         return None
 
     def to_representation(self, instance):


Test changes:
diff --git a/tests/test_serializers.py b/tests/test_serializers.py
index 07a0e02..8c986fc 100644
--- a/tests/test_serializers.py
+++ b/tests/test_serializers.py
@@ -368,7 +368,7 @@ def test_job_status_failure(self, mock_async_result):
         )
 
         # Add error info to route
-        self.route.info = "Route calculation failed due to invalid coordinates"
+        self.route.info = {"error": "Route calculation failed due to invalid coordinates"}
         self.route.save()
 
         # Mock Celery result