Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ jobs:
run: poetry install
- name: Poetry build
run: poetry build
- name: Poetry run pytest integration tests
- name: Poetry run tests
run: poetry run pytest tests
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ jobs:
run: poetry install
- name: Build Poetry
run: poetry build
- name: Poetry run pytest integration tests
- name: Poetry run tests
run: poetry run pytest tests
1 change: 1 addition & 0 deletions doc/changes/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Changelog

* [0.2.0](changes_0.2.0.md)
* [0.1.0](changes_0.1.0.md)
14 changes: 14 additions & 0 deletions doc/changes/changes_0.2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# error-reporting-python 0.2.0, released 2022-03-28

Code Name: Eliminated the nested set warning caused by the error code format

## Summary

In this release, we eliminated the nested set warning caused by the error-code format.
Furthermore, in case of having an invalid error code, ValueError is thrown instead of AssertError.

### Bug Fixes

- #8: Eliminated nested set warning in error code format


2 changes: 1 addition & 1 deletion exasol_error_reporting_python/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.0'
__version__ = '0.2.0'
6 changes: 3 additions & 3 deletions exasol_error_reporting_python/error_message_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from exasol_error_reporting_python.parameters_mapper import ParametersMapper
from exasol_error_reporting_python.placeholder_handler import PlaceholderHandler

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


class ErrorMessageBuilder:
Expand All @@ -12,7 +12,8 @@ class ErrorMessageBuilder:
"""

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

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

return " ".join(result)

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "exasol-error-reporting-python"
version = "0.1.0"
version = "0.2.0"
description = "Exasol Python Error Reporting"
license = "MIT"

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup_kwargs = {
'name': 'exasol-error-reporting-python',
'version': '0.1.0',
'version': '0.2.0',
'description': 'Exasol Python Error Reporting',
'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)',
'author': 'Umit Buyuksahin',
Expand Down
7 changes: 5 additions & 2 deletions tests/test_error_code_format.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import unittest

import pytest

from exasol_error_reporting_python.error_message_builder import \
ErrorMessageBuilder

Expand All @@ -14,8 +17,8 @@ def test_invalid_error_code_format(self):
"F-100"
]
for error_code in invalid_error_code_list:
with self.assertRaises(AssertionError):
builder = ErrorMessageBuilder(error_code)
with pytest.raises(ValueError):
assert ErrorMessageBuilder(error_code)

def test_valid_error_code_format(self):
valid_error_code_list = [
Expand Down