Skip to content

Adapts Exception Handler to conform standard#724

Merged
aaronzi merged 8 commits into
eclipse-basyx:mainfrom
FriedJannik:errorHandling
May 13, 2025
Merged

Adapts Exception Handler to conform standard#724
aaronzi merged 8 commits into
eclipse-basyx:mainfrom
FriedJannik:errorHandling

Conversation

@FriedJannik

@FriedJannik FriedJannik commented Apr 30, 2025

Copy link
Copy Markdown
Member

Description of Changes

This PR adapts the error handling to return meaningful messages in a standardised format.

Now each Error resulting from a request by the user should provide a meaningful and standardized error message:

[
    {
        "code": 400,
        "messageType": "Error",
        "correlationId": "MethodArgumentTypeMismatchException-400",
        "text": "Method parameter 'aasIdentifier': Failed to convert value of type 'java.lang.String' to required type 'org.eclipse.digitaltwin.basyx.http.Base64UrlEncodedIdentifier'; Failed to convert from type [java.lang.String] to type [@io.swagger.v3.oas.annotations.Parameter @org.springframework.web.bind.annotation.PathVariable org.eclipse.digitaltwin.basyx.http.Base64UrlEncodedIdentifier] for value [2]",
        "timestamp": "2025-05-07T06:49:08.352062600Z"
    }
]

Please note that timestamps are always provided in UTC ISO 8601.
The Correlation ID is always formed of the Exception Name and the Error Code, ensuring uniqueness.

Related Issue

#519

BaSyx Configuration for Testing

--

AAS Files Used for Testing

--

Additional Information

--

@FriedJannik

Copy link
Copy Markdown
Member Author

Note: MongoQueryException (Unathorized) also returns 500

@FriedJannik FriedJannik marked this pull request as ready for review May 12, 2025 04:57
@aaronzi aaronzi merged commit 0bac9fe into eclipse-basyx:main May 13, 2025
42 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants