Skip to content

Commit e21f181

Browse files
#8: Fixed the bug (#9)
* Fixed the bug * Changed to ValueError * Updated gitflow * Prepared for the release
1 parent e58b7a8 commit e21f181

File tree

9 files changed

+28
-10
lines changed

9 files changed

+28
-10
lines changed

.github/workflows/pytest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ jobs:
2222
run: poetry install
2323
- name: Poetry build
2424
run: poetry build
25-
- name: Poetry run pytest integration tests
25+
- name: Poetry run tests
2626
run: poetry run pytest tests

.github/workflows/release_droid_upload_github_release_assets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ jobs:
2727
run: poetry install
2828
- name: Build Poetry
2929
run: poetry build
30-
- name: Poetry run pytest integration tests
30+
- name: Poetry run tests
3131
run: poetry run pytest tests

doc/changes/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# Changelog
22

3+
* [0.2.0](changes_0.2.0.md)
34
* [0.1.0](changes_0.1.0.md)

doc/changes/changes_0.2.0.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# error-reporting-python 0.2.0, released 2022-03-28
2+
3+
Code Name: Eliminated the nested set warning caused by the error code format
4+
5+
## Summary
6+
7+
In this release, we eliminated the nested set warning caused by the error-code format.
8+
Furthermore, in case of having an invalid error code, ValueError is thrown instead of AssertError.
9+
10+
### Bug Fixes
11+
12+
- #8: Eliminated nested set warning in error code format
13+
14+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.1.0'
1+
__version__ = '0.2.0'

exasol_error_reporting_python/error_message_builder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from exasol_error_reporting_python.parameters_mapper import ParametersMapper
44
from exasol_error_reporting_python.placeholder_handler import PlaceholderHandler
55

6-
ERROR_CODE_FORMAT = "^[FEW]-[[A-Z][A-Z0-9]+(-[A-Z][A-Z0-9]+)*-[0-9]+$"
6+
ERROR_CODE_FORMAT = "^[FEW]-[A-Z][A-Z0-9]+(-[A-Z][A-Z0-9]+)*-[0-9]+$"
77

88

99
class ErrorMessageBuilder:
@@ -12,7 +12,8 @@ class ErrorMessageBuilder:
1212
"""
1313

1414
def __init__(self, error_code: str):
15-
assert re.compile(ERROR_CODE_FORMAT).match(error_code)
15+
if not re.compile(ERROR_CODE_FORMAT).match(error_code):
16+
raise ValueError(f"{error_code} is an invalid error-code format")
1617

1718
self._error_code = error_code
1819
self._message_builder = []
@@ -129,4 +130,3 @@ def __str__(self):
129130
result.append("\n".join(mitigations))
130131

131132
return " ".join(result)
132-

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "exasol-error-reporting-python"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
description = "Exasol Python Error Reporting"
55
license = "MIT"
66

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
setup_kwargs = {
1111
'name': 'exasol-error-reporting-python',
12-
'version': '0.1.0',
12+
'version': '0.2.0',
1313
'description': 'Exasol Python Error Reporting',
1414
'long_description': '# Error Reporting Python\n\nThis project contains a python library for describing Exasol error messages. \nThis library lets you define errors with a uniform set of attributes. \nFurthermore, the error message is implemented to be parseable, \nso that you can extract an error catalog from the code.\n\n\n## In a Nutshell\nCreate an error object:\n\n```python\nexa_error_obj = ExaError.message_builder(\'E-TEST-1\')\\\n .message("Not enough space on device {{device}}.")\\\n .mitigation("Delete something from {{device}}.")\\\n .mitigation("Create larger partition.")\\\n .parameter("device", "/dev/sda1", "name of the device") \n```\n\nUse it as string:\n\n```python\nprint(exa_error_obj)\n```\n\nResult:\n```\nE-TEST-1: Not enough space on device \'/dev/sda1\'. Known mitigations:\n* Delete something from \'/dev/sda1\'.\n* Create larger partition.\n```\n\n\nCheck out the [user guide](doc/user_guide/user_guide.md) for more details.\n\n### Information for Users\n\n* [User Guide](doc/user_guide/user_guide.md)\n* [Changelog](doc/changes/changelog.md)\n\nYou can find corresponding libraries for other languages here:\n\n* [Error reporting Java](https://github.com/exasol/error-reporting-java)\n* [Error reporting Lua](https://github.com/exasol/error-reporting-lua)\n* [Error reporting Go](https://github.com/exasol/error-reporting-go)\n* [Error reporting C#](https://github.com/exasol/error-reporting-csharp)\n\n### Information for Contributors\n\n* [System Requirement Specification](doc/system_requirements.md)\n* [Design](doc/design.md)\n* [Dependencies](doc/dependencies.md)',
1515
'author': 'Umit Buyuksahin',

tests/test_error_code_format.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import unittest
2+
3+
import pytest
4+
25
from exasol_error_reporting_python.error_message_builder import \
36
ErrorMessageBuilder
47

@@ -14,8 +17,8 @@ def test_invalid_error_code_format(self):
1417
"F-100"
1518
]
1619
for error_code in invalid_error_code_list:
17-
with self.assertRaises(AssertionError):
18-
builder = ErrorMessageBuilder(error_code)
20+
with pytest.raises(ValueError):
21+
assert ErrorMessageBuilder(error_code)
1922

2023
def test_valid_error_code_format(self):
2124
valid_error_code_list = [

0 commit comments

Comments
 (0)