Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/simplify error handling #1264

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

thomasBousselin
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the feature New feature or request label Nov 15, 2024
Copy link
Contributor

github-actions bot commented Nov 15, 2024

Test Results

 25 files   -  42   25 suites   - 42   34s ⏱️ -45s
355 tests  - 713  339 ✅  - 727  0 💤  - 2  16 ❌ +16 
355 runs   - 752  339 ✅  - 766  0 💤  - 2  16 ❌ +16 

For more details on these failures, see this check.

Results for commit c0287f9. ± Comparison against base commit 1bd270a.

This pull request removes 874 and adds 5 tests. Note that renamed tests count towards both.
                                    { "id":…, withTemporalValues=true, withAudit=false, expectation={
                      "@id": "https://uri…
                      "@type": "@json",
                      …
                    "@value": "/A/B"
                    "@value": "/C/D"
                    "@value": 20
                    "…
                    {
                  "@type": "https://uri.etsi.org/ngsi-ld/DateTime",
…
com.egm.stellio.shared.model.LanguageFilterTests ‑ [1] nl, "languageProperty": {
    "type": "Property",
    "value": "Grote Markt",
    "lang": "nl"
}
com.egm.stellio.shared.model.LanguageFilterTests ‑ [2] en, "languageProperty": {
    "type": "Property",
    "value": "Big Place",
    "lang": "@none"
}
com.egm.stellio.shared.model.LanguageFilterTests ‑ [3] *, "languageProperty": {
    "type": "Property",
    "value": "Big Place",
    "lang": "@none"
}
com.egm.stellio.shared.model.LanguageFilterTests ‑ [4] fr-CH,fr;q=0.9,en;q=0.8,*;q=0.5, "languageProperty": {
    "type": "Property",
    "value": "Grand Place",
    "lang": "fr"
}
com.egm.stellio.shared.util.JsonUtilsTests ‑ it should throw an InvalidRequest exception if the JSON-LD fragment is not a valid JSON document()

♻️ This comment has been updated with latest results.

logger.info("Returning server web exchange error ${this.type} (${this.message})")
exchange.response.statusCode = this.status
exchange.response.headers[CONTENT_TYPE] = MediaType.APPLICATION_JSON_VALUE
val body = serializeObject(this)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here, you are also serializing the inherited Exception class, which is not the expected thing.

btw, we should also get rid of this inherited class (in FP, errors should not be exceptions). not sure of the impacts, to be checked.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here, you are also serializing the inherited Exception class, which is not the expected thing.

Yes fixed

btw, we should also get rid of this inherited class (in FP, errors should not be exceptions). not sure of the impacts, to be checked.

ApiException are thrown 14 times. And each time the refacto could impact multiple layer of functions.


import java.net.URI

sealed class ErrorResponse(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be the ultimate hierarchy for representing errors (https://old.arrow-kt.io/docs/patterns/error_handling/)

@thomasBousselin thomasBousselin force-pushed the feature/simplify-error-handling branch 2 times, most recently from 384b5c1 to 16509a4 Compare November 18, 2024 13:50
@thomasBousselin thomasBousselin linked an issue Nov 18, 2024 that may be closed by this pull request
Copy link

sonarcloud bot commented Nov 18, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clearer error for specific cases
2 participants