-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat(bpdm-gate): Extend error states #985
Changes from 2 commits
1b5e887
9600d6a
cb2a888
b02caa5
daaafc5
d8901ee
1f15ba8
e4cc1be
77e40e8
a0a289a
5ea8c20
da24adf
201db14
069c5c0
f6fe478
041f856
cff1eb6
95de3fe
b2e0a9f
6299ee8
0febf9f
879381a
86c2581
8af4933
e344002
bedcf07
cb624c8
fa24b9c
0311826
2e2b7ab
a86e382
ff2863d
e514159
879d878
3fdff66
ac3cc8a
80d20bb
04e5cd9
a0394c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,18 @@ enum class BusinessPartnerSharingError : ErrorCode { | |
SharingTimeout, | ||
BpnNotInPool, | ||
MissingTaskID, | ||
NaturalPersonError, | ||
BpnErrorMissingParent, | ||
BpnErrorNotFound, | ||
BpnErrorTooManyOptions, | ||
MandatoryFieldValidationFailed, | ||
BlacklistCountryPresent, | ||
InvalidSpecialCharacters, | ||
MandatoryFieldMissing, | ||
BpnlChanged, | ||
UnclearEntity, | ||
UnknownSpecialCharacters, | ||
MatchBasedOnProvidedNameOrIdentifier | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also success state here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. re-added the error codes based on the discussion |
||
} | ||
|
||
enum class ChangeLogOutputError : ErrorCode { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,67 @@ class TaskResolutionService( | |
BusinessPartnerSharingError.SharingProcessError, | ||
if (task.processingState.errors.isNotEmpty()) task.processingState.errors.joinToString(" // ") { it.description }.take(255) else null | ||
) | ||
ResultState.NaturalPersonError -> RequestCreationResult.error( | ||
sharingState, | ||
BusinessPartnerSharingError.NaturalPersonError, | ||
if (task.processingState.errors.isNotEmpty()) task.processingState.errors.joinToString(" // ") { it.description }.take(255) else null | ||
) | ||
ResultState.BpnErrorMissingParent -> RequestCreationResult.error( | ||
sharingState, | ||
BusinessPartnerSharingError.BpnErrorMissingParent, | ||
if (task.processingState.errors.isNotEmpty()) task.processingState.errors.joinToString(" // ") { it.description }.take(255) else null | ||
) | ||
ResultState.BpnErrorNotFound -> RequestCreationResult.error( | ||
sharingState, | ||
BusinessPartnerSharingError.BpnErrorNotFound, | ||
if (task.processingState.errors.isNotEmpty()) task.processingState.errors.joinToString(" // ") { it.description }.take(255) else null | ||
) | ||
ResultState.BpnErrorTooManyOptions -> RequestCreationResult.error( | ||
sharingState, | ||
BusinessPartnerSharingError.BpnErrorTooManyOptions, | ||
if (task.processingState.errors.isNotEmpty()) task.processingState.errors.joinToString(" // ") { it.description }.take(255) else null | ||
) | ||
ResultState.MandatoryFieldValidationFailed -> RequestCreationResult.error( | ||
sharingState, | ||
BusinessPartnerSharingError.MandatoryFieldValidationFailed, | ||
if (task.processingState.errors.isNotEmpty()) task.processingState.errors.joinToString(" // ") { it.description }.take(255) else null | ||
) | ||
ResultState.BlacklistCountryPresent -> RequestCreationResult.error( | ||
sharingState, | ||
BusinessPartnerSharingError.BlacklistCountryPresent, | ||
if (task.processingState.errors.isNotEmpty()) task.processingState.errors.joinToString(" // ") { it.description }.take(255) else null | ||
) | ||
ResultState.InvalidSpecialCharacters -> RequestCreationResult.error( | ||
sharingState, | ||
BusinessPartnerSharingError.InvalidSpecialCharacters, | ||
if (task.processingState.errors.isNotEmpty()) task.processingState.errors.joinToString(" // ") { it.description }.take(255) else null | ||
) | ||
ResultState.MandatoryFieldMissing -> RequestCreationResult.error( | ||
sharingState, | ||
BusinessPartnerSharingError.MandatoryFieldMissing, | ||
if (task.processingState.errors.isNotEmpty()) task.processingState.errors.joinToString(" // ") { it.description }.take(255) else null | ||
) | ||
ResultState.BpnlChanged -> RequestCreationResult.error( | ||
sharingState, | ||
BusinessPartnerSharingError.BpnlChanged, | ||
if (task.processingState.errors.isNotEmpty()) task.processingState.errors.joinToString(" // ") { it.description }.take(255) else null | ||
) | ||
ResultState.UnclearEntity -> RequestCreationResult.error( | ||
sharingState, | ||
BusinessPartnerSharingError.UnclearEntity, | ||
if (task.processingState.errors.isNotEmpty()) task.processingState.errors.joinToString(" // ") { it.description }.take(255) else null | ||
) | ||
ResultState.UnknownSpecialCharacters -> RequestCreationResult.error( | ||
sharingState, | ||
BusinessPartnerSharingError.UnknownSpecialCharacters, | ||
if (task.processingState.errors.isNotEmpty()) task.processingState.errors.joinToString(" // ") { it.description }.take(255) else null | ||
) | ||
ResultState.MatchBasedOnProvidedNameOrIdentifier -> RequestCreationResult.error( | ||
sharingState, | ||
BusinessPartnerSharingError.MatchBasedOnProvidedNameOrIdentifier, | ||
if (task.processingState.errors.isNotEmpty()) task.processingState.errors.joinToString(" // ") { it.description }.take(255) else null | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks unnecessarily verbose. Currently, the Gate's sharing state only has up to one error it can display. I would propose to use the generic SharingProcessError type if there are several errors, just like it is currently done. And if there is only one error we can save the more specific error here. For this I would then use a when-clause mapping from Task error type to Gate error and then map to a RequestCreationResult afterwards. Proposal somethind like this fun handleError(...) : RequestCreatinResult{
if(errors.size == 1){
when(taskErrorType){
UnkownSpecialCharacters -> GateErrorType.UnknownSpecialCharacters
...
}.map{ gatErrorType -> RequestCreationResult.erro(...) }
}else{
RequestCreationResult.error(...) like before
}
} |
||
) | ||
|
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,17 @@ package org.eclipse.tractusx.orchestrator.api.model | |
enum class ResultState { | ||
Pending, | ||
Success, | ||
Error | ||
Error, | ||
NaturalPersonError, | ||
BpnErrorMissingParent, | ||
BpnErrorNotFound, | ||
BpnErrorTooManyOptions, | ||
MandatoryFieldValidationFailed, | ||
BlacklistCountryPresent, | ||
InvalidSpecialCharacters, | ||
MandatoryFieldMissing, | ||
BpnlChanged, | ||
UnclearEntity, | ||
UnknownSpecialCharacters, | ||
MatchBasedOnProvidedNameOrIdentifier | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Result state indicate a high-level distinction between success, error and in-progress. This is not the place to put specific error types. For this, you can use the TaskErrorType in the same package |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not an error code but a comment or success state which we currently do not support in the orchestrator