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

[items] Fix issue with removeItem() #122

Merged
merged 1 commit into from
May 27, 2022

Conversation

florian-h05
Copy link
Contributor

@florian-h05 florian-h05 commented May 27, 2022

Bugfix

Fixes #120.

The check that should verify that the Item successfully has been removed,
has thrown an ItemNotFouncException which was not caught.

Signed-off-by: Florian Hotze florianh_dev@icloud.com

Testing

for (var i = 0; i < 4; i++) {
  items.replaceItem({
    name: 'test' + i,
    type: 'Switch'
  });
}

items.removeItem('test5'); // Item does not exist, should log error.

var cleanup_items = true; 
if (cleanup_items) {
  var item_list = items.getItemsByTag('_DYNAMIC_');
  console.log(item_list.map(item => item.name).toString());
  item_list.forEach((item) => {
      items.removeItem(item.name)
      console.log('Deleted:' + item.name)
  })
}

Fixes .itemRemove() openhab#120.

The check that should verify that the Item successfully has been removed,
has thrown an ItemNotFouncException which was not caught.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
@florian-h05 florian-h05 added the bug Something isn't working label May 27, 2022
@florian-h05 florian-h05 requested a review from digitaldan May 27, 2022 13:47
Copy link
Contributor

@digitaldan digitaldan left a comment

Choose a reason for hiding this comment

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

lgtm

@digitaldan digitaldan merged commit b3e86a7 into openhab:main May 27, 2022
@florian-h05 florian-h05 deleted the items-removeitem branch May 27, 2022 21:46
@florian-h05 florian-h05 added this to the 1.2.4 milestone May 27, 2022
@florian-h05 florian-h05 changed the title [items] Fix removeItem [items] Fix issue with removeItem() May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[items] removeItem() fails with error message
2 participants