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

Improved: Add groovydsl method : failure to return a map (OFBIZ-13195) #867

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

nmalin
Copy link
Contributor

@nmalin nmalin commented Dec 16, 2024

With groovy dsl we have possibility to return in one line when failure appears but we can only sent a failure message like this :


return failure('bad state')

If we need to return information on out we need to realize it like :


Map result = failure('bad state')
result.statusId = 'BAD_STATUS'
return result

Like success() we improved it to do in one line:


return failure('bad state', [statusId: 'BAD_STATUS'])

By the way we align success function to refactoring them with default value so remove two unnecessary

With groovy dsl we have possibility to return in one line when failure appears but we can only sent a failure message like this :

****
    return failure('bad state')
****

If we need to return information on out we need to realize it like :

****
    Map result = failure('bad state')
    result.statusId = 'BAD_STATUS'
    return result
****

Like success() we improved it to do in one line:

****
    return failure('bad state', [statusId: 'BAD_STATUS'])
****

By the way we align success function to refactoring them with default value so remove two unnecessary
@JacquesLeRoux
Copy link
Contributor

Hi Nicolas,

Only quickly reviewed, sounds good to me.

@nmalin
Copy link
Contributor Author

nmalin commented Dec 18, 2024

Thanks for your look !

@nmalin nmalin merged commit f493eb2 into apache:trunk Dec 18, 2024
7 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