Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Unités] Ajouter un flag "Adresse de diffusion de l'unité" sur les co…
…ntacts unité (#1338) ## Related Pull Requests & Issues - Resolve #1271 Reviewable, only tasks left with @AdelineCelier: - [x] Ask for new broadcast/subscription Icon and add it to monitor-ui. - [x] Check if saving should be instant when subscribing/unsubscribing or once submit button is clicked (current state) => UX a bit weird with warning message + banner before saving the form? - [x] Double-check buttons title ---- - [x] Tests E2E (Cypress)
- Loading branch information
Showing
133 changed files
with
5,140 additions
and
1,925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
backend/src/main/kotlin/fr/gouv/cacem/monitorenv/domain/entities/ErrorCode.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...nd/src/main/kotlin/fr/gouv/cacem/monitorenv/domain/exceptions/BackendInternalException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package fr.gouv.cacem.monitorenv.domain.exceptions | ||
|
||
import org.slf4j.Logger | ||
import org.slf4j.LoggerFactory | ||
|
||
/** | ||
* Domain exception to throw when an internal error occurred in the backend. | ||
* | ||
* ## Examples | ||
* - An unexpected exception has been caught. | ||
* | ||
* ## Logging | ||
* This exception is logged as an error on the Backend side. | ||
*/ | ||
open class BackendInternalException( | ||
final override val message: String, | ||
val originalException: Exception? = null, | ||
) : Throwable(message) { | ||
private val logger: Logger = LoggerFactory.getLogger(BackendInternalException::class.java) | ||
|
||
init { | ||
logger.error("BackendInternalException: $message") | ||
originalException?.let { logger.error("${it::class.simpleName}: ${it.message}") } | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
backend/src/main/kotlin/fr/gouv/cacem/monitorenv/domain/exceptions/BackendUsageErrorCode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package fr.gouv.cacem.monitorenv.domain.exceptions | ||
|
||
/** | ||
* Error code thrown when the request is valid but the backend cannot process it. | ||
* | ||
* It's called "usage" because this request likely comes from an end-user action that's no longer valid | ||
* which happens when their client data is not up-to-date with the backend. | ||
* | ||
* But it can also be a Frontend side bug. | ||
* | ||
* ## Examples | ||
* - A user tries to create a resource that has already been created. | ||
* - A user tries to delete a resource that doesn't exist anymore. | ||
* | ||
* ## Logging | ||
* The related exception is NOT logged on the Backend side. | ||
* It should be logged on the Frontend side IF it's unexpected (= Frontend bug), | ||
* it should rather display a comprehensible error message to the end-user. | ||
* | ||
* ### ⚠️ Important | ||
* **Don't forget to mirror any update here in the corresponding Frontend enum.** | ||
*/ | ||
enum class BackendUsageErrorCode { | ||
/** Thrown when attempting to attach a mission to a reporting that has already a mission attached. */ | ||
CHILD_ALREADY_ATTACHED, | ||
|
||
/** Thrown when attempting to archive an entity linked to non-archived child(ren). */ | ||
UNARCHIVED_CHILD, | ||
|
||
/** Thrown when attempting to delete a mission that has actions created by other applications. */ | ||
EXISTING_MISSION_ACTION, | ||
} |
25 changes: 22 additions & 3 deletions
25
backend/src/main/kotlin/fr/gouv/cacem/monitorenv/domain/exceptions/BackendUsageException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,24 @@ | ||
package fr.gouv.cacem.monitorenv.domain.exceptions | ||
|
||
import fr.gouv.cacem.monitorenv.domain.entities.ErrorCode | ||
|
||
class BackendUsageException(val code: ErrorCode, val data: Any) : Throwable(code.name) | ||
/** | ||
* Domain exception to throw when a request is valid but the backend cannot process it. | ||
* | ||
* It's called "usage" because this request likely comes from an end-user action that's no longer valid | ||
* which happens when their client data is not up-to-date with the backend. | ||
* | ||
* But it can also be a Frontend side bug. | ||
* | ||
* ## Examples | ||
* - A user tries to create a resource that has already been created. | ||
* - A user tries to delete a resource that doesn't exist anymore. | ||
* | ||
* ## Logging | ||
* This exception is NOT logged on the Backend side. | ||
* It should be logged on the Frontend side IF it's unexpected (= Frontend bug), | ||
* it should rather display a comprehensible error message to the end-user. | ||
*/ | ||
open class BackendUsageException( | ||
val code: BackendUsageErrorCode, | ||
final override val message: String? = null, | ||
val data: Any? = null, | ||
) : Throwable(code.name) |
4 changes: 0 additions & 4 deletions
4
backend/src/main/kotlin/fr/gouv/cacem/monitorenv/domain/exceptions/CodeNotFoundException.kt
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
...nd/src/main/kotlin/fr/gouv/cacem/monitorenv/domain/exceptions/CouldNotArchiveException.kt
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...end/src/main/kotlin/fr/gouv/cacem/monitorenv/domain/exceptions/CouldNotDeleteException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
package fr.gouv.cacem.monitorenv.domain.exceptions | ||
|
||
@Deprecated("Use `BackendUsageException` instead.") | ||
class CouldNotDeleteException(message: String) : RuntimeException(message) |
4 changes: 0 additions & 4 deletions
4
.../main/kotlin/fr/gouv/cacem/monitorenv/domain/exceptions/CouldNotUpdateMissionException.kt
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...d/src/main/kotlin/fr/gouv/cacem/monitorenv/domain/exceptions/EntityConversionException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
package fr.gouv.cacem.monitorenv.domain.exceptions | ||
|
||
@Deprecated("Use `BackendUsageException` with the right code instead (depending on the case).") | ||
class EntityConversionException(message: String, cause: Throwable? = null) : | ||
Throwable(message, cause) |
1 change: 1 addition & 0 deletions
1
backend/src/main/kotlin/fr/gouv/cacem/monitorenv/domain/exceptions/NotFoundException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
package fr.gouv.cacem.monitorenv.domain.exceptions | ||
|
||
@Deprecated("Use `BackendUsageException` instead.") | ||
class NotFoundException(message: String, cause: Throwable? = null) : | ||
Throwable(message, cause) |
1 change: 1 addition & 0 deletions
1
...in/kotlin/fr/gouv/cacem/monitorenv/domain/exceptions/ReportingAlreadyAttachedException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
package fr.gouv.cacem.monitorenv.domain.exceptions | ||
|
||
/** Thrown when attempting to attach a reporting already attached to a mission. */ | ||
@Deprecated("Use `BackendUsageException` instead.") | ||
class ReportingAlreadyAttachedException(message: String) : RuntimeException(message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.